Compare commits
69 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2af164ee9e | |||
| 9227f0a195 | |||
| f18330b494 | |||
| bb32339ab4 | |||
| ddf4378dfe | |||
| 2a607e209b | |||
| a3d85ae8c3 | |||
| fef62b63cb | |||
| 93ec80f773 | |||
| 8e3795c317 | |||
| cb1a633dc5 | |||
| ace4db6938 | |||
| b770062788 | |||
| 4c4dc5398a | |||
| 091945152f | |||
| 4838611273 | |||
| 144f9959c9 | |||
| 291c6a8fa0 | |||
| d5d3581b78 | |||
| 64d90b027c | |||
| a0e9989734 | |||
| b81aa923d6 | |||
| 610925bc5a | |||
| 86eda9bb10 | |||
| ca06aa9a6f | |||
| ca57d9e83d | |||
| 904f975f0c | |||
| 9b9212cf4c | |||
| 404419d1c3 | |||
| 4ee94a6574 | |||
| f929df0419 | |||
| 57587dafbe | |||
| 31a95e81b3 | |||
| 70a4e9551b | |||
| e1a705f975 | |||
| 9057ec82d8 | |||
| 1b53e36666 | |||
| 10fa5c7bd2 | |||
| 06e72a5a60 | |||
| 8fa62fc300 | |||
| 6c345fc508 | |||
| a34eac4ecb | |||
| 10c121e603 | |||
| 2b910167f4 | |||
| 7d5311a075 | |||
| f5581c4b49 | |||
| e09f7cd49c | |||
| 4dab03b61b | |||
| 2b5e017aa1 | |||
| 8b3d944fd2 | |||
| 2d886fd38a | |||
| 80088832b9 | |||
| be1883f317 | |||
| 30119e0c77 | |||
| c90c3b1544 | |||
| 578386f083 | |||
| 3d21ed362e | |||
| 9cf469b035 | |||
| 462c93ae43 | |||
| bda3b7b24d | |||
| d861a22cdd | |||
| 0de1a182da | |||
| b030554348 | |||
| 858bfa9ccd | |||
| ee8ec78da7 | |||
| c8f684895c | |||
| 138a155ba4 | |||
| ad749bf345 | |||
| ff0d59c16b |
@@ -1,4 +1,11 @@
|
||||
# https://help.github.com/articles/dealing-with-line-endings
|
||||
#
|
||||
# For Mac & Linux
|
||||
# git config --global core.autocrlf input
|
||||
#
|
||||
# For windows
|
||||
# git config --global core.autocrlf true
|
||||
#
|
||||
# Set default behaviour, in case users don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
|
||||
@@ -5,4 +5,3 @@ notifications:
|
||||
disabled: true
|
||||
before_install:
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install -y --force-yes asciidoc
|
||||
@@ -1,4 +1,4 @@
|
||||
source 'http://rubygems.org'
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gemspec
|
||||
gem 'rake', '~> 0.9'
|
||||
gem 'rake', '~> 10.0.2'
|
||||
|
||||
+5
-1
@@ -73,6 +73,10 @@ opts = OptionParser.new do |opts|
|
||||
wiki_options[:mathjax] = true
|
||||
end
|
||||
|
||||
opts.on("--user-icons [SOURCE]", "Set the history user icons. Valid values: gravatar, identicon, none. Default: none.") do |source|
|
||||
wiki_options[:user_icons] = source
|
||||
end
|
||||
|
||||
opts.on("--show-all", "Shows all files in file view. By default only valid pages are shown.") do
|
||||
wiki_options[:show_all] = true
|
||||
end
|
||||
@@ -181,6 +185,6 @@ else
|
||||
end
|
||||
end
|
||||
# Rack::Handler does not work with Ctrl + C. Use Rack::Server instead.
|
||||
Rack::Server.new(:app => MapGollum.new(base_path), :Port => options['port']).start
|
||||
Rack::Server.new(:app => MapGollum.new(base_path), :Port => options['port'], :Host => options['bind']).start
|
||||
end
|
||||
end
|
||||
|
||||
+109
-23
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
||||
s.required_ruby_version = ">= 1.8.7"
|
||||
|
||||
s.name = 'gollum'
|
||||
s.version = '2.4.0'
|
||||
s.date = '2012-11-11'
|
||||
s.version = '2.4.7'
|
||||
s.date = '2012-12-20'
|
||||
s.rubyforge_project = 'gollum'
|
||||
|
||||
s.summary = "A simple, Git-powered wiki."
|
||||
@@ -25,22 +25,22 @@ Gem::Specification.new do |s|
|
||||
|
||||
s.add_dependency('grit', '~> 2.5.0')
|
||||
s.add_dependency('github-markup', ['>= 0.7.4', '< 1.0.0'])
|
||||
s.add_dependency('github-markdown', '~> 0.5.1')
|
||||
s.add_dependency('github-markdown', '~> 0.5.3')
|
||||
s.add_dependency('pygments.rb', '~> 0.3.2')
|
||||
s.add_dependency('sinatra', '~> 1.3.3')
|
||||
s.add_dependency('mustache', ['>= 0.99.4', '< 1.0.0'])
|
||||
s.add_dependency('sanitize', '~> 2.0.3')
|
||||
s.add_dependency('nokogiri', '~> 1.5.5')
|
||||
s.add_dependency('useragent', '~> 0.4.12')
|
||||
s.add_dependency('stringex', '~> 1.4.0')
|
||||
s.add_dependency('useragent', '~> 0.4.15')
|
||||
s.add_dependency('stringex', '~> 1.5.1')
|
||||
|
||||
s.add_development_dependency('RedCloth', '~> 4.2.9')
|
||||
s.add_development_dependency('mocha', '~> 0.12.7')
|
||||
s.add_development_dependency('mocha', '~> 0.13.0')
|
||||
s.add_development_dependency('org-ruby', '~> 0.7.2')
|
||||
s.add_development_dependency('shoulda', '~> 3.3.1')
|
||||
s.add_development_dependency('shoulda', '~> 3.3.2')
|
||||
s.add_development_dependency('rack-test', '~> 0.6.2')
|
||||
s.add_development_dependency('wikicloth', '~> 0.8.0')
|
||||
s.add_development_dependency('rake', '~> 0.9')
|
||||
s.add_development_dependency('rake', '~> 10.0.2')
|
||||
s.add_development_dependency('pry', '~> 0.9.10')
|
||||
# required by pry
|
||||
s.add_development_dependency('rb-readline', '~> 0.4.2')
|
||||
@@ -75,6 +75,7 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/images/fileview/toggle-small-expand.png
|
||||
lib/gollum/frontend/public/gollum/images/fileview/toggle-small.png
|
||||
lib/gollum/frontend/public/gollum/images/icon-sprite.png
|
||||
lib/gollum/frontend/public/gollum/images/man_24.png
|
||||
lib/gollum/frontend/public/gollum/images/para.png
|
||||
lib/gollum/frontend/public/gollum/images/pin-16.png
|
||||
lib/gollum/frontend/public/gollum/images/pin-20.png
|
||||
@@ -91,6 +92,7 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js
|
||||
lib/gollum/frontend/public/gollum/javascript/gollum.js
|
||||
lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
|
||||
lib/gollum/frontend/public/gollum/javascript/identicon_canvas.js
|
||||
lib/gollum/frontend/public/gollum/javascript/jquery-1.7.2.min.js
|
||||
lib/gollum/frontend/public/gollum/javascript/jquery.color.js
|
||||
lib/gollum/frontend/public/gollum/javascript/mousetrap.min.js
|
||||
@@ -111,6 +113,7 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/codefolding-fold-button-states.png
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/expand-marker.png
|
||||
@@ -161,6 +164,55 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/package.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/test_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_javascript.txt
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c9search.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c_cpp.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_clojure.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coffee.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coldfusion.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_csharp.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_css.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_diff.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_glsl.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_golang.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_groovy.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_haxe.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_html.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_java.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_javascript.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_json.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_jsx.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_latex.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_less.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_liquid.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_lua.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_luapage.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_markdown.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ocaml.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_perl.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_pgsql.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_php.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_powershell.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_python.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ruby.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scad.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scala.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scss.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sh.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sql.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_svg.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_tcl.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_text.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_textile.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xml.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xquery.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_yaml.json
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/abap.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/abap_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js
|
||||
@@ -196,9 +248,12 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/dart.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/dart_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/asciidoc.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js
|
||||
@@ -208,24 +263,34 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/latex.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/lua.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/markdown.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/glsl.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/glsl_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haml.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haml_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jade.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jade_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript/jshint.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js
|
||||
@@ -236,6 +301,8 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsp.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsp_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js
|
||||
@@ -245,14 +312,24 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lisp.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lisp_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lucene.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lucene_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lucene_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/makefile.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/makefile_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js
|
||||
@@ -266,6 +343,12 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/r.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/r_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js
|
||||
@@ -279,30 +362,31 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/stylus.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/stylus_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tcl.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tcl_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tex.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tex_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/typescript.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/typescript_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Position.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/JSONParseTreeHandler.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/StringLexer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XMLLexer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTLexer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTParser.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryLexer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQuerySemanticHighlighter.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/antlr3-all.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/xquery.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/visitors/SyntaxHighlighter.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js
|
||||
@@ -317,10 +401,6 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/definitions.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/lexer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/options.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/parser.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range.js
|
||||
@@ -348,6 +428,8 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockdom.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/tests.html
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/ambiance.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/ambiance.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css
|
||||
@@ -400,15 +482,16 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.css
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer_dev.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/undomanager.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/unicode.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jshint.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jslint.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js
|
||||
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js
|
||||
@@ -438,6 +521,9 @@ Gem::Specification.new do |s|
|
||||
lib/gollum/frontend/templates/error.mustache
|
||||
lib/gollum/frontend/templates/file_view.mustache
|
||||
lib/gollum/frontend/templates/history.mustache
|
||||
lib/gollum/frontend/templates/history_authors/gravatar.mustache
|
||||
lib/gollum/frontend/templates/history_authors/identicon.mustache
|
||||
lib/gollum/frontend/templates/history_authors/none.mustache
|
||||
lib/gollum/frontend/templates/layout.mustache
|
||||
lib/gollum/frontend/templates/page.mustache
|
||||
lib/gollum/frontend/templates/pages.mustache
|
||||
|
||||
+6
-1
@@ -1,6 +1,7 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
# stdlib
|
||||
require 'digest/md5'
|
||||
require 'digest/sha1'
|
||||
require 'ostruct'
|
||||
|
||||
# external
|
||||
@@ -22,8 +23,12 @@ require File.expand_path('../gollum/sanitization', __FILE__)
|
||||
require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
|
||||
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
||||
|
||||
# Set ruby to UTF-8 mode
|
||||
# This is required for Ruby 1.8.7 which gollum still supports.
|
||||
$KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
|
||||
|
||||
module Gollum
|
||||
VERSION = '2.4.0'
|
||||
VERSION = '2.4.7'
|
||||
|
||||
def self.assets_path
|
||||
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
|
||||
|
||||
@@ -85,6 +85,10 @@ module Gollum
|
||||
#
|
||||
# Returns nothing (modifies the Index in place).
|
||||
def add_to_index(dir, name, format, data, allow_same_ext = false)
|
||||
# spaces must be dashes
|
||||
dir.gsub!(' ', '-')
|
||||
name.gsub!(' ', '-')
|
||||
|
||||
path = @wiki.page_file_name(name, format)
|
||||
|
||||
dir = '/' if dir.strip.empty?
|
||||
|
||||
@@ -18,8 +18,7 @@ class String
|
||||
# _Header => header which causes errors
|
||||
def to_url
|
||||
return nil if self.nil?
|
||||
return self if ['_Header', '_Footer', '_Sidebar'].include? self
|
||||
upstream_to_url
|
||||
upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar']
|
||||
end
|
||||
end
|
||||
|
||||
@@ -85,6 +84,7 @@ module Precious
|
||||
@base_url = url('/', false).chomp('/')
|
||||
# above will detect base_path when it's used with map in a config.ru
|
||||
settings.wiki_options.merge!({ :base_path => @base_url })
|
||||
@css = settings.wiki_options[:css]
|
||||
end
|
||||
|
||||
get '/' do
|
||||
@@ -181,7 +181,8 @@ module Precious
|
||||
|
||||
page = wikip.page
|
||||
if page
|
||||
redirect to("/#{page.escaped_url_path}")
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
redirect to("/#{clean_url(::File.join(page_dir, page.escaped_url_path))}")
|
||||
else
|
||||
mustache :create
|
||||
end
|
||||
@@ -191,18 +192,13 @@ module Precious
|
||||
name = params[:page].to_url
|
||||
path = sanitize_empty_params(params[:path]) || ''
|
||||
format = params[:format].intern
|
||||
|
||||
# ensure pages are created in page_file_dir
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
path = clean_url(::File.join(page_dir, path)) unless path.start_with?(page_dir)
|
||||
|
||||
# write_page is not directory aware so use wiki_options to emulate dir support.
|
||||
wiki_options = settings.wiki_options.merge({ :page_file_dir => path })
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
|
||||
wiki = wiki_new
|
||||
|
||||
begin
|
||||
wiki.write_page(name, format, params[:content], commit_message)
|
||||
redirect to("/#{clean_url(::File.join(path,name))}")
|
||||
wiki.write_page(name, format, params[:content], commit_message, path)
|
||||
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
redirect to("/#{clean_url(::File.join(page_dir, path, name))}")
|
||||
rescue Gollum::DuplicatePageError => e
|
||||
@message = "Duplicate page: #{e.message}"
|
||||
mustache :error
|
||||
@@ -238,7 +234,6 @@ module Precious
|
||||
@content = @page.formatted_data
|
||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||
@mathjax = wiki.mathjax
|
||||
@css = wiki.css
|
||||
@h1_title = wiki.h1_title
|
||||
@editable = false
|
||||
mustache :page
|
||||
@@ -284,10 +279,6 @@ module Precious
|
||||
mustache :compare
|
||||
end
|
||||
|
||||
get %r{^/(javascript|css|images)} do
|
||||
halt 404
|
||||
end
|
||||
|
||||
get %r{/(.+?)/([0-9a-f]{40})} do
|
||||
file_path = params[:captures][0]
|
||||
version = params[:captures][1]
|
||||
@@ -352,9 +343,6 @@ module Precious
|
||||
path = extract_path(fullpath) || '/'
|
||||
wiki = wiki_new
|
||||
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
path = ::File.join(page_dir, path) unless path.start_with?(page_dir)
|
||||
|
||||
if page = wiki.paged(name, path, exact = true)
|
||||
@page = page
|
||||
@name = name
|
||||
@@ -362,7 +350,6 @@ module Precious
|
||||
@content = page.formatted_data
|
||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||
@mathjax = wiki.mathjax
|
||||
@css = wiki.css
|
||||
@h1_title = wiki.h1_title
|
||||
mustache :page
|
||||
elsif file = wiki.file(fullpath)
|
||||
|
||||
@@ -21,7 +21,9 @@ body, html {
|
||||
#wiki-wrapper {
|
||||
margin: 0 auto;
|
||||
overflow: visible;
|
||||
width: 80%;
|
||||
width: 920px;
|
||||
padding-left:20px;
|
||||
padding-right:20px;
|
||||
}
|
||||
|
||||
a:link {
|
||||
@@ -697,14 +699,14 @@ ul.actions {
|
||||
|
||||
#pages li a.file,
|
||||
#pages li a.folder {
|
||||
background-image: url(/images/fileview/document.png);
|
||||
background-image: url(../images/fileview/document.png);
|
||||
background-position: 0 1px;
|
||||
background-repeat: no-repeat;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
#pages li a.folder {
|
||||
background-image: url(/images/fileview/folder-horizontal.png);
|
||||
background-image: url(../images/fileview/folder-horizontal.png);
|
||||
}
|
||||
|
||||
#pages .breadcrumb {
|
||||
|
||||
@@ -97,20 +97,16 @@ a.absent {
|
||||
.markdown-body h1 {
|
||||
font-size: 28px;
|
||||
color: #000;
|
||||
margin-top: 50px;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.markdown-body h2 {
|
||||
font-size: 24px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
color: #000;
|
||||
margin-top: 40px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.markdown-body h3 {
|
||||
font-size: 18px;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.markdown-body h4 {
|
||||
font-size: 16px;
|
||||
@@ -127,10 +123,13 @@ a.absent {
|
||||
.markdown-body ul,
|
||||
.markdown-body ol,
|
||||
.markdown-body dl,
|
||||
.markdown-body li,
|
||||
.markdown-body table,
|
||||
.markdown-body pre {
|
||||
margin: 15px 0;
|
||||
margin: 0px 0;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.markdown-body li {
|
||||
margin: 0px;
|
||||
}
|
||||
.markdown-body hr {
|
||||
background: transparent url(../images/dirty-shade.png) repeat-x 0 0;
|
||||
@@ -146,12 +145,9 @@ a.absent {
|
||||
.markdown-body>h5:first-child,
|
||||
.markdown-body>h6:first-child {
|
||||
}
|
||||
.markdown-body h1+h2{
|
||||
.markdown-body h1+h2+h3{
|
||||
margin-top: 30px;
|
||||
}
|
||||
.markdown-body h2+h3{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.markdown-body a:first-child h1,
|
||||
.markdown-body a:first-child h2,
|
||||
.markdown-body a:first-child h3,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 376 B |
@@ -233,6 +233,7 @@
|
||||
$('#gollum-dialog-dialog').animate({ opacity: 1 }, {
|
||||
duration: 500
|
||||
});
|
||||
$($('#gollum-dialog-dialog input[type="text"]').get(0)).focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -228,4 +228,21 @@ $(document).ready(function() {
|
||||
});
|
||||
$.GollumEditor({ NewFile: true, MarkupType: default_markup });
|
||||
}
|
||||
|
||||
if( $('#wiki-history').length ){
|
||||
var lookup = {};
|
||||
$('img.identicon').each(function(index, element){
|
||||
var $item = $(element);
|
||||
var code = parseInt($item.data('identicon'), 10);
|
||||
var img_bin = lookup[code];
|
||||
if( img_bin === undefined ){
|
||||
var size = 16;
|
||||
var canvas = $('<canvas width=16 height=16/>').get(0);
|
||||
render_identicon(canvas, code, 16);
|
||||
img_bin = canvas.toDataURL("image/png");
|
||||
lookup[code] = img_bin;
|
||||
}
|
||||
$item.attr('src', img_bin);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
Client-side Canvas tag based Identicon rendering code
|
||||
|
||||
@author Don Park
|
||||
@version 0.2
|
||||
@date January 21th, 2007
|
||||
*/
|
||||
|
||||
var patch0 = new Array( 0, 4, 24, 20 );
|
||||
var patch1 = new Array( 0, 4, 20 );
|
||||
var patch2 = new Array( 2, 24, 20 );
|
||||
var patch3 = new Array( 0, 2, 20, 22 );
|
||||
var patch4 = new Array( 2, 14, 22, 10 );
|
||||
var patch5 = new Array( 0, 14, 24, 22 );
|
||||
var patch6 = new Array( 2, 24, 22, 13, 11, 22, 20 );
|
||||
var patch7 = new Array( 0, 14, 22 );
|
||||
var patch8 = new Array( 6, 8, 18, 16 );
|
||||
var patch9 = new Array( 4, 20, 10, 12, 2 );
|
||||
var patch10 = new Array( 0, 2, 12, 10 );
|
||||
var patch11 = new Array( 10, 14, 22 );
|
||||
var patch12 = new Array( 20, 12, 24 );
|
||||
var patch13 = new Array( 10, 2, 12 );
|
||||
var patch14 = new Array( 0, 2, 10 );
|
||||
var patchTypes = new Array( patch0, patch1, patch2, patch3, patch4,
|
||||
patch5, patch6, patch7, patch8, patch9, patch10, patch11,
|
||||
patch12, patch13, patch14, patch0 );
|
||||
var centerPatchTypes = new Array(0, 4, 8, 15);
|
||||
|
||||
function render_identicon_patch(ctx, x, y, size, patch, turn, invert, foreColor, backColor) {
|
||||
patch %= patchTypes.length;
|
||||
turn %= 4;
|
||||
if (patch == 15)
|
||||
invert = !invert;
|
||||
|
||||
var vertices = patchTypes[patch];
|
||||
var offset = size / 2;
|
||||
var scale = size / 4;
|
||||
|
||||
ctx.save();
|
||||
|
||||
// paint background
|
||||
ctx.fillStyle = invert ? foreColor : backColor;
|
||||
ctx.fillRect(x, y, size, size);
|
||||
|
||||
// build patch path
|
||||
ctx.translate(x + offset, y + offset);
|
||||
ctx.rotate(turn * Math.PI / 2);
|
||||
ctx.beginPath();
|
||||
ctx.moveTo((vertices[0] % 5 * scale - offset), (Math.floor(vertices[0] / 5) * scale - offset));
|
||||
for (var i = 1; i < vertices.length; i++)
|
||||
ctx.lineTo((vertices[i] % 5 * scale - offset), (Math.floor(vertices[i] / 5) * scale - offset));
|
||||
ctx.closePath();
|
||||
|
||||
// offset and rotate coordinate space by patch position (x, y) and
|
||||
// 'turn' before rendering patch shape
|
||||
|
||||
// render rotated patch using fore color (back color if inverted)
|
||||
ctx.fillStyle = invert ? backColor : foreColor;
|
||||
ctx.fill();
|
||||
|
||||
// restore rotation
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function render_identicon(node, code, size) {
|
||||
if (!node || !code || !size) return;
|
||||
|
||||
var patchSize = size / 3;
|
||||
var middleType = centerPatchTypes[code & 3];
|
||||
var middleInvert = ((code >> 2) & 1) != 0;
|
||||
var cornerType = (code >> 3) & 15;
|
||||
var cornerInvert = ((code >> 7) & 1) != 0;
|
||||
var cornerTurn = (code >> 8) & 3;
|
||||
var sideType = (code >> 10) & 15;
|
||||
var sideInvert = ((code >> 14) & 1) != 0;
|
||||
var sideTurn = (code >> 15) & 3;
|
||||
var blue = (code >> 16) & 31;
|
||||
var green = (code >> 21) & 31;
|
||||
var red = (code >> 27) & 31;
|
||||
var foreColor = "rgb(" + (red << 3) + "," + (green << 3) + "," + (blue << 3) + ")";
|
||||
var backColor = "rgb(255,255,255)";
|
||||
|
||||
var ctx = node.getContext("2d");
|
||||
|
||||
// middle patch
|
||||
render_identicon_patch(ctx, patchSize, patchSize, patchSize, middleType, 0, middleInvert, foreColor, backColor);
|
||||
// side patchs, starting from top and moving clock-wise
|
||||
render_identicon_patch(ctx, patchSize, 0, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
|
||||
render_identicon_patch(ctx, patchSize * 2, patchSize, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
|
||||
render_identicon_patch(ctx, patchSize, patchSize * 2, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
|
||||
render_identicon_patch(ctx, 0, patchSize, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
|
||||
// corner patchs, starting from top left and moving clock-wise
|
||||
render_identicon_patch(ctx, 0, 0, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
|
||||
render_identicon_patch(ctx, patchSize * 2, 0, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
|
||||
render_identicon_patch(ctx, patchSize * 2, patchSize * 2, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
|
||||
render_identicon_patch(ctx, 0, patchSize * 2, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
|
||||
}
|
||||
|
||||
function render_identicon_canvases(prefix) {
|
||||
var canvases = document.getElementsByTagName("canvas");
|
||||
var n = canvases.length;
|
||||
for (var i = 0; i < n; i++) {
|
||||
var node = canvases[i];
|
||||
if (node.title && node.title.indexOf(prefix) == 0) {
|
||||
if (node.style.display == 'none') node.style.display = "inline";
|
||||
var code = node.title.substring(prefix.length) * 1;
|
||||
var size = node.width;
|
||||
render_identicon(node, code, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,37 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Skywriter.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Kevin Dangoor (kdangoor@mozilla.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* class Ace
|
||||
*
|
||||
* The main class required to set up an Ace instance in the browser.
|
||||
*
|
||||
*
|
||||
* @class Ace
|
||||
**/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
@@ -48,8 +39,8 @@ define(function(require, exports, module) {
|
||||
|
||||
require("./lib/fixoldbrowsers");
|
||||
|
||||
var Dom = require("./lib/dom");
|
||||
var Event = require("./lib/event");
|
||||
var dom = require("./lib/dom");
|
||||
var event = require("./lib/event");
|
||||
|
||||
var Editor = require("./editor").Editor;
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
@@ -60,44 +51,57 @@ var MultiSelect = require("./multi_select").MultiSelect;
|
||||
// The following require()s are for inclusion in the built ace file
|
||||
require("./worker/worker_client");
|
||||
require("./keyboard/hash_handler");
|
||||
require("./keyboard/state_handler");
|
||||
require("./placeholder");
|
||||
require("./mode/folding/fold_mode");
|
||||
exports.config = require("./config");
|
||||
/**
|
||||
* Ace.edit(el) -> Editor
|
||||
* - el (String | DOMElement): Either the id of an element, or the element itself
|
||||
*
|
||||
* This method embeds the Ace editor into the DOM, at the element provided by `el`.
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* Provides access to require in packed noconflict mode
|
||||
* @param {String} moduleName
|
||||
* @returns {Object}
|
||||
*
|
||||
**/
|
||||
exports.require = require;
|
||||
|
||||
/**
|
||||
* Embeds the Ace editor into the DOM, at the element provided by `el`.
|
||||
* @param {String | DOMElement} el Either the id of an element, or the element itself
|
||||
*
|
||||
**/
|
||||
exports.edit = function(el) {
|
||||
if (typeof(el) == "string") {
|
||||
el = document.getElementById(el);
|
||||
var _id = el;
|
||||
var el = document.getElementById(_id);
|
||||
if (!el)
|
||||
throw "ace.edit can't find div #" + _id;
|
||||
}
|
||||
|
||||
if (el.env && el.env.editor instanceof Editor)
|
||||
return el.env.editor;
|
||||
|
||||
var doc = new EditSession(Dom.getInnerText(el));
|
||||
doc.setUndoManager(new UndoManager());
|
||||
var doc = exports.createEditSession(dom.getInnerText(el));
|
||||
el.innerHTML = '';
|
||||
|
||||
var editor = new Editor(new Renderer(el, require("./theme/textmate")));
|
||||
var editor = new Editor(new Renderer(el));
|
||||
new MultiSelect(editor);
|
||||
editor.setSession(doc);
|
||||
|
||||
var env = {};
|
||||
env.document = doc;
|
||||
env.editor = editor;
|
||||
editor.resize();
|
||||
Event.addListener(window, "resize", function() {
|
||||
editor.resize();
|
||||
});
|
||||
el.env = env;
|
||||
// Store env on editor such that it can be accessed later on from
|
||||
// the returned object.
|
||||
editor.env = env;
|
||||
var env = {
|
||||
document: doc,
|
||||
editor: editor,
|
||||
onResize: editor.resize.bind(editor)
|
||||
};
|
||||
event.addListener(window, "resize", env.onResize);
|
||||
el.env = editor.env = env;
|
||||
return editor;
|
||||
};
|
||||
|
||||
|
||||
exports.createEditSession = function(text, mode) {
|
||||
var doc = new EditSession(text, doc);
|
||||
doc.setUndoManager(new UndoManager());
|
||||
return doc;
|
||||
}
|
||||
exports.EditSession = EditSession;
|
||||
exports.UndoManager = UndoManager;
|
||||
});
|
||||
|
||||
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -42,20 +35,20 @@ var oop = require("./lib/oop");
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* class Anchor
|
||||
*
|
||||
* Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated
|
||||
*
|
||||
* Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.
|
||||
*
|
||||
* @class Anchor
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Anchor(doc, row, column)
|
||||
* - doc (Document): The document to associate with the anchor
|
||||
* - row (Number): The starting row position
|
||||
* - column (Number): The starting column position
|
||||
*
|
||||
* Creates a new `Anchor` and associates it with a document.
|
||||
*
|
||||
* @param {Document} doc The document to associate with the anchor
|
||||
* @param {Number} row The starting row position
|
||||
* @param {Number} column The starting column position
|
||||
*
|
||||
* @constructor
|
||||
**/
|
||||
|
||||
var Anchor = exports.Anchor = function(doc, row, column) {
|
||||
@@ -75,10 +68,8 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
/**
|
||||
* Anchor.getPosition() -> Object
|
||||
*
|
||||
* Returns an object identifying the `row` and `column` position of the current anchor.
|
||||
*
|
||||
* @returns {Object}
|
||||
**/
|
||||
|
||||
this.getPosition = function() {
|
||||
@@ -86,10 +77,9 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Anchor.getDocument() -> Document
|
||||
*
|
||||
*
|
||||
* Returns the current document.
|
||||
*
|
||||
* @returns {Document}
|
||||
**/
|
||||
|
||||
this.getDocument = function() {
|
||||
@@ -97,10 +87,17 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Anchor@onChange(e)
|
||||
* - e (Event): Contains data about the event
|
||||
* Fires whenever the anchor position changes.
|
||||
*
|
||||
* Both of these objects have a `row` and `column` property corresponding to the position.
|
||||
*
|
||||
* Events that can trigger this function include [[Anchor.setPosition `setPosition()`]].
|
||||
*
|
||||
* @event change
|
||||
* @param {Object} e An object containing information about the anchor position. It has two properties:
|
||||
* - `old`: An object describing the old Anchor position
|
||||
* - `value`: An object describing the new Anchor position
|
||||
*
|
||||
* Fires whenever the anchor position changes. Events that can trigger this function include `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
|
||||
*
|
||||
**/
|
||||
|
||||
@@ -170,12 +167,12 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Anchor.setPosition(row, column, noClip)
|
||||
* - row (Number): The row index to move the anchor to
|
||||
* - column (Number): The column index to move the anchor to
|
||||
* - noClip (Boolean): Identifies if you want the position to be clipped
|
||||
*
|
||||
* Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped.
|
||||
* @param {Number} row The row index to move the anchor to
|
||||
* @param {Number} column The column index to move the anchor to
|
||||
* @param {Boolean} noClip Identifies if you want the position to be clipped
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
@@ -208,8 +205,6 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Anchor.detach()
|
||||
*
|
||||
* When called, the `'change'` event listener is removed.
|
||||
*
|
||||
**/
|
||||
@@ -218,15 +213,14 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
||||
this.document.removeEventListener("change", this.$onChange);
|
||||
};
|
||||
|
||||
/** internal, hide
|
||||
* Anchor.clipPositionToDocument(row, column)
|
||||
* - row (Number): The row index to clip the anchor to
|
||||
* - column (Number): The column index to clip the anchor to
|
||||
*
|
||||
/**
|
||||
* Clips the anchor position to the specified row and column.
|
||||
* @param {Number} row The row index to clip the anchor to
|
||||
* @param {Number} column The column index to clip the anchor to
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
this.$clipPositionToDocument = function(row, column) {
|
||||
var pos = {};
|
||||
|
||||
|
||||
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
+56
-63
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -45,20 +38,23 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
var MAX_LINE_LENGTH = 5000;
|
||||
|
||||
/**
|
||||
* class BackgroundTokenizer
|
||||
*
|
||||
*
|
||||
* Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use. If a certain row is changed, everything below that row is re-tokenized.
|
||||
* Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use.
|
||||
*
|
||||
* If a certain row is changed, everything below that row is re-tokenized.
|
||||
*
|
||||
* @class BackgroundTokenizer
|
||||
**/
|
||||
|
||||
/**
|
||||
* new BackgroundTokenizer(tokenizer, editor)
|
||||
* - tokenizer (Tokenizer): The tokenizer to use
|
||||
* - editor (Editor): The editor to associate with
|
||||
*
|
||||
* Creates a new `BackgroundTokenizer` object.
|
||||
* @param {Tokenizer} tokenizer The tokenizer to use
|
||||
* @param {Editor} editor The editor to associate with
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @constructor
|
||||
**/
|
||||
|
||||
var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
@@ -105,11 +101,10 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.setTokenizer(tokenizer)
|
||||
* - tokenizer (Tokenizer): The new tokenizer to use
|
||||
*
|
||||
* Sets a new tokenizer for this object.
|
||||
*
|
||||
* @param {Tokenizer} tokenizer The new tokenizer to use
|
||||
*
|
||||
**/
|
||||
this.setTokenizer = function(tokenizer) {
|
||||
this.tokenizer = tokenizer;
|
||||
@@ -120,11 +115,8 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.setDocument(doc)
|
||||
* - doc (Document): The new document to associate with
|
||||
*
|
||||
* Sets a new document to associate with this object.
|
||||
*
|
||||
* @param {Document} doc The new document to associate with
|
||||
**/
|
||||
this.setDocument = function(doc) {
|
||||
this.doc = doc;
|
||||
@@ -134,12 +126,17 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
this.stop();
|
||||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.fireUpdateEvent(firstRow, lastRow)
|
||||
* - firstRow (Number): The starting row region
|
||||
* - lastRow (Number): The final row region
|
||||
/**
|
||||
* Fires whenever the background tokeniziers between a range of rows are going to be updated.
|
||||
*
|
||||
* @event update
|
||||
* @param {Object} e An object containing two properties, `first` and `last`, which indicate the rows of the region being updated.
|
||||
*
|
||||
**/
|
||||
/**
|
||||
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
|
||||
* @param {Number} firstRow The starting row region
|
||||
* @param {Number} lastRow The final row region
|
||||
*
|
||||
**/
|
||||
this.fireUpdateEvent = function(firstRow, lastRow) {
|
||||
@@ -151,11 +148,10 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.start(startRow)
|
||||
* - startRow (Number): The row to start at
|
||||
*
|
||||
* Starts tokenizing at the row indicated.
|
||||
*
|
||||
* @param {Number} startRow The row to start at
|
||||
*
|
||||
**/
|
||||
this.start = function(startRow) {
|
||||
this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
|
||||
@@ -194,8 +190,6 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.stop()
|
||||
*
|
||||
* Stops tokenizing.
|
||||
*
|
||||
**/
|
||||
@@ -205,12 +199,12 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
this.running = false;
|
||||
};
|
||||
|
||||
/** related to: BackgroundTokenizer.$tokenizeRows
|
||||
* BackgroundTokenizer.getTokens(firstRow, lastRow) -> [Object]
|
||||
* - firstRow (Number): The row to start at
|
||||
* - lastRow (Number): The row to finish at
|
||||
/**
|
||||
* Gives list of tokens of the row. (tokens are cached)
|
||||
*
|
||||
* @param {Number} row The row to get tokens at
|
||||
*
|
||||
* Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.getTokens = function(row) {
|
||||
@@ -218,10 +212,9 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.getState(row) -> String
|
||||
* - row (Number): The row to start at
|
||||
*
|
||||
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
|
||||
*
|
||||
* @param {Number} row The row to get state at
|
||||
**/
|
||||
this.getState = function(row) {
|
||||
if (this.currentLine == row)
|
||||
|
||||
+25
-32
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Harutyun Amirjanyan <harutyun@c9.io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
+16
-16
@@ -6,26 +6,24 @@ var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
||||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* class CommandManager
|
||||
* @class CommandManager
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new CommandManager(platform, commands)
|
||||
* @param {String} platform Identifier for the platform; must be either `'mac'` or `'win'`
|
||||
* @param {Array} commands A list of commands
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new CommandManager(platform, commands)
|
||||
* - platform (String): Identifier for the platform; must be either `'mac'` or `'win'`
|
||||
* - commands (Array): A list of commands
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
var CommandManager = function(platform, commands) {
|
||||
this.platform = platform;
|
||||
this.commands = {};
|
||||
this.commands = this.byName = {};
|
||||
this.commmandKeyBinding = {};
|
||||
|
||||
this.addCommands(commands);
|
||||
@@ -60,9 +58,11 @@ oop.inherits(CommandManager, HashHandler);
|
||||
return retvalue === false ? false : true;
|
||||
};
|
||||
|
||||
this.toggleRecording = function() {
|
||||
this.toggleRecording = function(editor) {
|
||||
if (this.$inReplay)
|
||||
return;
|
||||
|
||||
editor && editor._emit("changeStatus");
|
||||
if (this.recording) {
|
||||
this.macro.pop();
|
||||
this.removeEventListener("exec", this.$addCommandToMacro);
|
||||
@@ -74,8 +74,8 @@ oop.inherits(CommandManager, HashHandler);
|
||||
}
|
||||
if (!this.$addCommandToMacro) {
|
||||
this.$addCommandToMacro = function(e) {
|
||||
this.macro.push([e.command, e.args]);
|
||||
}.bind(this);
|
||||
this.macro.push([e.command, e.args]);
|
||||
}.bind(this);
|
||||
}
|
||||
|
||||
this.oldMacro = this.macro;
|
||||
@@ -89,7 +89,7 @@ oop.inherits(CommandManager, HashHandler);
|
||||
return;
|
||||
|
||||
if (this.recording)
|
||||
return this.toggleRecording();
|
||||
return this.toggleRecording(editor);
|
||||
|
||||
try {
|
||||
this.$inReplay = true;
|
||||
|
||||
+59
-53
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -68,20 +61,20 @@ module.exports = {
|
||||
},
|
||||
|
||||
"test: mac hotkeys": function() {
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "L");
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
|
||||
assert.equal(command, this.command);
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "L");
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "l");
|
||||
assert.equal(command, undefined);
|
||||
},
|
||||
|
||||
"test: win hotkeys": function() {
|
||||
var cm = new CommandManager("win", [this.command]);
|
||||
|
||||
var command = cm.findKeyCommand(keys.KEY_MODS.command, "L");
|
||||
var command = cm.findKeyCommand(keys.KEY_MODS.command, "l");
|
||||
assert.equal(command, undefined);
|
||||
|
||||
var command = cm.findKeyCommand(keys.KEY_MODS.ctrl, "L");
|
||||
var command = cm.findKeyCommand(keys.KEY_MODS.ctrl, "l");
|
||||
assert.equal(command, this.command);
|
||||
},
|
||||
|
||||
@@ -91,7 +84,7 @@ module.exports = {
|
||||
this.cm.exec("gotoline");
|
||||
assert.ok(!this.command.called);
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "L");
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
|
||||
assert.equal(command, null);
|
||||
},
|
||||
|
||||
@@ -101,7 +94,7 @@ module.exports = {
|
||||
this.cm.exec("gotoline");
|
||||
assert.ok(!this.command.called);
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "L");
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
|
||||
assert.equal(command, null);
|
||||
},
|
||||
|
||||
@@ -121,14 +114,14 @@ module.exports = {
|
||||
assert.ok(command.called);
|
||||
assert.ok(!this.command.called);
|
||||
|
||||
assert.equal(this.cm.findKeyCommand(keys.KEY_MODS.command, "L"), command);
|
||||
assert.equal(this.cm.findKeyCommand(keys.KEY_MODS.command, "l"), command);
|
||||
},
|
||||
|
||||
"test: adding commands and recording a macro": function() {
|
||||
var called = "";
|
||||
this.cm.addCommands({
|
||||
togglerecording: function(editor) {
|
||||
editor.cm.toggleRecording();
|
||||
editor.cm.toggleRecording(editor);
|
||||
},
|
||||
replay: function(editor) {
|
||||
editor.cm.replay();
|
||||
@@ -140,9 +133,14 @@ module.exports = {
|
||||
called += "2";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var statusUpdateEmitted = false;
|
||||
this._emit = function() {statusUpdateEmitted = true};
|
||||
|
||||
this.cm.exec("togglerecording", this);
|
||||
assert.ok(this.cm.recording);
|
||||
assert.ok(statusUpdateEmitted);
|
||||
|
||||
this.cm.exec("cm1", this, "-");
|
||||
this.cm.exec("cm2");
|
||||
@@ -156,33 +154,41 @@ module.exports = {
|
||||
},
|
||||
|
||||
"test: bindkeys": function() {
|
||||
var called = "";
|
||||
this.cm.addCommands({
|
||||
cm1: function(editor, arg) {
|
||||
called += "1" + (arg || "");
|
||||
},
|
||||
cm2: function(editor) {
|
||||
called += "2";
|
||||
}
|
||||
});
|
||||
|
||||
this.cm.bindKeys({
|
||||
"Ctrl-L|Command-C": "cm1",
|
||||
"Ctrl-R": "cm2"
|
||||
});
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "C");
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "c");
|
||||
assert.equal(command, "cm1");
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "R");
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r");
|
||||
assert.equal(command, "cm2");
|
||||
|
||||
this.cm.bindKeys({
|
||||
"Ctrl-R": null
|
||||
});
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "R");
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r");
|
||||
assert.equal(command, null);
|
||||
},
|
||||
|
||||
"test: binding keys without modifiers": function() {
|
||||
this.cm.bindKeys({
|
||||
"R": "cm1",
|
||||
"Shift-r": "cm2",
|
||||
"Return": "cm4",
|
||||
"Enter": "cm3"
|
||||
});
|
||||
|
||||
var command = this.cm.findKeyCommand(-1, "r");
|
||||
assert.equal(command, "cm1");
|
||||
|
||||
var command = this.cm.findKeyCommand(-1, "R");
|
||||
assert.equal(command, "cm2");
|
||||
|
||||
var command = this.cm.findKeyCommand(0, "return");
|
||||
assert.equal(command, "cm3");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+46
-39
@@ -1,40 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -117,11 +107,13 @@ exports.commands = [{
|
||||
name: "selecttostart",
|
||||
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
|
||||
exec: function(editor) { editor.getSelection().selectFileStart(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotostart",
|
||||
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
|
||||
exec: function(editor) { editor.navigateFileStart(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectup",
|
||||
@@ -286,7 +278,7 @@ exports.commands = [{
|
||||
}, {
|
||||
name: "togglerecording",
|
||||
bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
|
||||
exec: function(editor) { editor.commands.toggleRecording(); },
|
||||
exec: function(editor) { editor.commands.toggleRecording(editor); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "replaymacro",
|
||||
@@ -295,13 +287,13 @@ exports.commands = [{
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "jumptomatching",
|
||||
bindKey: bindKey("Ctrl-P", "Ctrl-P"),
|
||||
bindKey: bindKey("Ctrl-P", "Ctrl-Shift-P"),
|
||||
exec: function(editor) { editor.jumpToMatching(); },
|
||||
multiSelectAction: "forEach",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selecttomatching",
|
||||
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
|
||||
bindKey: bindKey("Ctrl-Shift-P", null),
|
||||
exec: function(editor) { editor.jumpToMatching(true); },
|
||||
readOnly: true
|
||||
},
|
||||
@@ -329,11 +321,26 @@ exports.commands = [{
|
||||
bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
|
||||
exec: function(editor) { editor.duplicateSelection(); },
|
||||
multiSelectAction: "forEach"
|
||||
}, {
|
||||
name: "sortlines",
|
||||
bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
|
||||
exec: function(editor) { editor.sortLines(); },
|
||||
multiSelectAction: "forEach"
|
||||
}, {
|
||||
name: "togglecomment",
|
||||
bindKey: bindKey("Ctrl-/", "Command-/"),
|
||||
exec: function(editor) { editor.toggleCommentLines(); },
|
||||
multiSelectAction: "forEach"
|
||||
}, {
|
||||
name: "modifyNumberUp",
|
||||
bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
|
||||
exec: function(editor) { editor.modifyNumber(1); },
|
||||
multiSelectAction: "forEach"
|
||||
}, {
|
||||
name: "modifyNumberDown",
|
||||
bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
|
||||
exec: function(editor) { editor.modifyNumber(-1); },
|
||||
multiSelectAction: "forEach"
|
||||
}, {
|
||||
name: "replace",
|
||||
bindKey: bindKey("Ctrl-R", "Command-Option-F"),
|
||||
|
||||
+32
-36
@@ -1,38 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Harutyun Amirjanyan <amirjanyan AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -82,11 +74,15 @@ exports.defaultCommands = [{
|
||||
}, {
|
||||
name: "splitIntoLines",
|
||||
exec: function(editor) { editor.multiSelect.splitIntoLines(); },
|
||||
bindKey: {win: "Ctrl-Shift-L", mac: "Ctrl-Shift-L"},
|
||||
bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
|
||||
readonly: true
|
||||
}, {
|
||||
name: "alignCursors",
|
||||
exec: function(editor) { editor.alignCursors(); },
|
||||
bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}
|
||||
}];
|
||||
|
||||
// commands active in multiselect mode
|
||||
// commands active only in multiselect mode
|
||||
exports.multiSelectCommands = [{
|
||||
name: "singleSelection",
|
||||
bindKey: "esc",
|
||||
|
||||
@@ -1,38 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -47,23 +39,25 @@ var global = (function() {
|
||||
|
||||
var options = {
|
||||
packaged: false,
|
||||
workerPath: "",
|
||||
modePath: "",
|
||||
themePath: "",
|
||||
suffix: ".js"
|
||||
workerPath: null,
|
||||
modePath: null,
|
||||
themePath: null,
|
||||
basePath: "",
|
||||
suffix: ".js",
|
||||
$moduleUrls: {}
|
||||
};
|
||||
|
||||
exports.get = function(key) {
|
||||
if (!options.hasOwnProperty(key))
|
||||
throw new Error("Unknown config key: " + key);
|
||||
|
||||
|
||||
return options[key];
|
||||
};
|
||||
|
||||
exports.set = function(key, value) {
|
||||
if (!options.hasOwnProperty(key))
|
||||
throw new Error("Unknown config key: " + key);
|
||||
|
||||
|
||||
options[key] = value;
|
||||
};
|
||||
|
||||
@@ -71,6 +65,28 @@ exports.all = function() {
|
||||
return lang.copyObject(options);
|
||||
};
|
||||
|
||||
exports.moduleUrl = function(name, component) {
|
||||
if (options.$moduleUrls[name])
|
||||
return options.$moduleUrls[name];
|
||||
|
||||
var parts = name.split("/");
|
||||
component = component || parts[parts.length - 2] || "";
|
||||
var base = parts[parts.length - 1].replace(component, "").replace(/(^[\-_])|([\-_]$)/, "");
|
||||
|
||||
if (!base && parts.length > 1)
|
||||
base = parts[parts.length - 2];
|
||||
var path = options[component + "Path"];
|
||||
if (path == null)
|
||||
path = options.basePath;
|
||||
if (path && path.slice(-1) != "/")
|
||||
path += "/";
|
||||
return path + component + "-" + base + this.get("suffix");
|
||||
};
|
||||
|
||||
exports.setModuleUrl = function(name, subst) {
|
||||
return options.$moduleUrls[name] = subst;
|
||||
};
|
||||
|
||||
exports.init = function() {
|
||||
options.packaged = require.packaged || module.packaged || (global.define && define.packaged);
|
||||
|
||||
@@ -79,16 +95,15 @@ exports.init = function() {
|
||||
|
||||
var scriptOptions = {};
|
||||
var scriptUrl = "";
|
||||
|
||||
|
||||
var scripts = document.getElementsByTagName("script");
|
||||
for (var i=0; i<scripts.length; i++) {
|
||||
var script = scripts[i];
|
||||
|
||||
var src = script.src || script.getAttribute("src");
|
||||
if (!src) {
|
||||
if (!src)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
var attributes = script.attributes;
|
||||
for (var j=0, l=attributes.length; j < l; j++) {
|
||||
var attr = attributes[j];
|
||||
@@ -101,17 +116,17 @@ exports.init = function() {
|
||||
if (m)
|
||||
scriptUrl = m[1];
|
||||
}
|
||||
|
||||
|
||||
if (scriptUrl) {
|
||||
scriptOptions.base = scriptOptions.base || scriptUrl;
|
||||
scriptOptions.packaged = true;
|
||||
}
|
||||
|
||||
|
||||
scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base;
|
||||
scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base;
|
||||
scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base;
|
||||
delete scriptOptions.base;
|
||||
|
||||
|
||||
for (var key in scriptOptions)
|
||||
if (typeof scriptOptions[key] !== "undefined")
|
||||
exports.set(key, scriptOptions[key]);
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var config = require("./config");
|
||||
var assert = require("./test/assertions");
|
||||
|
||||
module.exports = {
|
||||
|
||||
"test path resolution" : function() {
|
||||
config.set("packaged", "true");
|
||||
var url = config.moduleUrl("kr_theme", "theme");
|
||||
assert.equal(url, "theme-kr.js");
|
||||
|
||||
config.set("basePath", "a/b");
|
||||
url = config.moduleUrl("m/theme", "theme");
|
||||
assert.equal(url, "a/b/theme-m.js");
|
||||
|
||||
url = config.moduleUrl("m/theme", "ext");
|
||||
assert.equal(url, "a/b/ext-theme.js");
|
||||
|
||||
config.set("workerPath", "c/");
|
||||
url = config.moduleUrl("foo/1", "worker");
|
||||
assert.equal(url, "c/worker-1.js");
|
||||
|
||||
config.setModuleUrl("foo/1", "a/b1.js");
|
||||
url = config.moduleUrl("foo/1", "theme");
|
||||
assert.equal(url, "a/b1.js");
|
||||
|
||||
assert.equal();
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec()
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
.ace_editor {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Droid Sans Mono', 'Consolas', monospace;
|
||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
.ace_content {
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
@@ -27,13 +27,20 @@
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
.ace_scroller.horscroll {
|
||||
.ace_gutter-active-line {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.ace_scroller.ace_scroll-left {
|
||||
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
|
||||
}
|
||||
|
||||
.ace_gutter-cell {
|
||||
padding-left: 19px;
|
||||
padding-right: 6px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.ace_gutter-cell.ace_error {
|
||||
@@ -44,7 +51,6 @@
|
||||
|
||||
.ace_gutter-cell.ace_warning {
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTg4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTk4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBNjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBNzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgd7PfIAAAGmSURBVHjaYvr//z8DJZiJgUIANoCRkREb9gLiSVAaQx4OQM7AAkwd7XU2/v++/rOttdYGEB9dASEvOMydGKfH8Gv/p4XTkvRBfLxeQAP+1cUhXopyvzhP7P/IoSj7g7Mw09cNKO6J1QQ0L4gICPIv/veg/8W+JdFvQNLHVsW9/nmn9zk7B+cCkDwhL7gt6knSZnx9/LuCEOcvkIAMP+cvto9nfqyZmmUAksfnBUtbM60gX/3/kgyv3/xSFOL5DZT+L8vP+Yfh5cvfPvp/xUHyQHXGyAYwgpwBjZYFT3Y1OEl/OfCH4ffv3wzc4iwMvNIsDJ+f/mH4+vIPAxsb631WW0Yln6ZpQLXdMK/DXGDflh+sIv37EivD5x//Gb7+YWT4y86sl7BCCkSD+Z++/1dkvsFRl+HnD1Rvje4F8whjMXmGj58YGf5zsDMwcnAwfPvKcml62DsQDeaDxN+/Y0qwlpEHqrdB94IRNIDUgfgfKJChGK4OikEW3gTiXUB950ASLFAF54AC94A0G9QAfOnmF9DCDzABFqS08IHYDIScdijOjQABBgC+/9awBH96jwAAAABJRU5ErkJggg==");
|
||||
background-repeat: no-repeat;
|
||||
background-position: 2px center;
|
||||
}
|
||||
|
||||
@@ -56,50 +62,40 @@
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=");
|
||||
}
|
||||
|
||||
.ace_editor .ace_sb {
|
||||
.ace_scrollbar {
|
||||
position: absolute;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.ace_editor .ace_sb div {
|
||||
.ace_scrollbar-inner {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.ace_editor .ace_print_margin_layer {
|
||||
z-index: 0;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ace_editor .ace_print_margin {
|
||||
.ace_print-margin {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.ace_editor > textarea {
|
||||
.ace_text-input {
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
width: 0.5em;
|
||||
height: 1em;
|
||||
opacity: 0;
|
||||
background: transparent;
|
||||
appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
border: none;
|
||||
resize: none;
|
||||
outline: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ace_editor > textarea.ace_composition {
|
||||
.ace_text-input.ace_composition {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
z-index: 1000;
|
||||
@@ -115,17 +111,16 @@
|
||||
white-space: nowrap;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
/* setting pointer-events: auto; on node under the mouse, which changes
|
||||
during scroll, will break mouse wheel scrolling in Safari */
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.ace_gutter .ace_layer {
|
||||
.ace_gutter-layer {
|
||||
position: relative;
|
||||
min-width: 40px;
|
||||
width: auto;
|
||||
text-align: right;
|
||||
pointer-events: auto;
|
||||
@@ -148,13 +143,28 @@
|
||||
.ace_cursor {
|
||||
z-index: 4;
|
||||
position: absolute;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.ace_cursor.ace_hidden {
|
||||
.ace_hidden-cursors .ace_cursor {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
.ace_editor.multiselect .ace_cursor {
|
||||
.ace_smooth-blinking .ace_cursor {
|
||||
-moz-transition: opacity 0.18s;
|
||||
-webkit-transition: opacity 0.18s;
|
||||
-o-transition: opacity 0.18s;
|
||||
-ms-transition: opacity 0.18s;
|
||||
transition: opacity 0.18s;
|
||||
}
|
||||
|
||||
.ace_cursor[style*="opacity: 0"]{
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
||||
}
|
||||
|
||||
.ace_editor.ace_multiselect .ace_cursor {
|
||||
border-left-width: 1px;
|
||||
}
|
||||
|
||||
@@ -177,23 +187,23 @@
|
||||
z-index: 6;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_active_line {
|
||||
.ace_marker-layer .ace_active-line {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_selected_word {
|
||||
.ace_marker-layer .ace_selected-word {
|
||||
position: absolute;
|
||||
z-index: 4;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.ace_line .ace_fold {
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
|
||||
display: inline-block;
|
||||
height: 11px;
|
||||
@@ -227,39 +237,55 @@
|
||||
background-position: center center, top left;
|
||||
}
|
||||
|
||||
.ace_dragging .ace_content {
|
||||
.ace_editor.ace_dragging .ace_content {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
.ace_gutter-tooltip {
|
||||
background-color: #FFFFD5;
|
||||
border: 1px solid gray;
|
||||
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
|
||||
color: black;
|
||||
display: inline-block;
|
||||
padding: 4px;
|
||||
position: absolute;
|
||||
z-index: 300;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
cursor: default;
|
||||
white-space: pre-line;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.ace_folding-enabled > .ace_gutter-cell {
|
||||
padding-right: 13px;
|
||||
}
|
||||
|
||||
.ace_fold-widget {
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
|
||||
margin: 0 -12px 1px 1px;
|
||||
margin: 0 -12px 0 1px;
|
||||
display: inline-block;
|
||||
height: 14px;
|
||||
width: 11px;
|
||||
vertical-align: text-bottom;
|
||||
vertical-align: top;
|
||||
|
||||
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82");
|
||||
background-repeat: no-repeat;
|
||||
background-position: center 4px;
|
||||
background-position: center;
|
||||
|
||||
border-radius: 3px;
|
||||
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
.ace_fold-widget.end {
|
||||
.ace_fold-widget.ace_end {
|
||||
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82");
|
||||
}
|
||||
|
||||
.ace_fold-widget.closed {
|
||||
.ace_fold-widget.ace_closed {
|
||||
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82");
|
||||
}
|
||||
|
||||
@@ -269,7 +295,6 @@
|
||||
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
||||
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
||||
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
|
||||
background-position: center 4px;
|
||||
}
|
||||
|
||||
.ace_fold-widget:active {
|
||||
@@ -285,10 +310,10 @@
|
||||
.ace_dark .ace_fold-widget {
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");
|
||||
}
|
||||
.ace_dark .ace_fold-widget.end {
|
||||
.ace_dark .ace_fold-widget.ace_end {
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
|
||||
}
|
||||
.ace_dark .ace_fold-widget.closed {
|
||||
.ace_dark .ace_fold-widget.ace_closed {
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
|
||||
}
|
||||
.ace_dark .ace_fold-widget:hover {
|
||||
@@ -303,7 +328,7 @@
|
||||
|
||||
|
||||
|
||||
.ace_fold-widget.invalid {
|
||||
.ace_fold-widget.ace_invalid {
|
||||
background-color: #FFB4B4;
|
||||
border-color: #DE5555;
|
||||
}
|
||||
@@ -325,3 +350,19 @@
|
||||
transition: opacity 0.05s ease 0.05s;
|
||||
opacity:1;
|
||||
}
|
||||
|
||||
.ace_underline {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.ace_bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ace_nobold .ace_bold {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.ace_italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -44,20 +37,20 @@ var Range = require("./range").Range;
|
||||
var Anchor = require("./anchor").Anchor;
|
||||
|
||||
/**
|
||||
* class Document
|
||||
*
|
||||
* Contains the text of the document. Documents are controlled by a single [[EditSession `EditSession`]]. At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index.
|
||||
* Contains the text of the document. Document can be attached to several [[EditSession `EditSession`]]s.
|
||||
*
|
||||
* At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index.
|
||||
*
|
||||
* @class Document
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Document([text])
|
||||
* - text (String | Array): The starting text
|
||||
*
|
||||
* Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
|
||||
*
|
||||
* @param {String | Array} text The starting text
|
||||
* @constructor
|
||||
**/
|
||||
|
||||
var Document = function(text) {
|
||||
this.$lines = [];
|
||||
|
||||
@@ -77,10 +70,9 @@ var Document = function(text) {
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
/**
|
||||
* Document.setValue(text) -> Void
|
||||
* - text (String): The text to use
|
||||
*
|
||||
* Replaces all the lines in the current `Document` with the value of `text`.
|
||||
*
|
||||
* @param {String} text The text to use
|
||||
**/
|
||||
this.setValue = function(text) {
|
||||
var len = this.getLength();
|
||||
@@ -89,8 +81,6 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.getValue() -> String
|
||||
*
|
||||
* Returns all the lines in the document as a single string, split by the new line character.
|
||||
**/
|
||||
this.getValue = function() {
|
||||
@@ -98,23 +88,23 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.createAnchor(row, column) -> Anchor
|
||||
* - row (Number): The row number to use
|
||||
* - column (Number): The column number to use
|
||||
*
|
||||
* Creates a new `Anchor` to define a floating point in the document.
|
||||
* @param {Number} row The row number to use
|
||||
* @param {Number} column The column number to use
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.createAnchor = function(row, column) {
|
||||
return new Anchor(this, row, column);
|
||||
};
|
||||
|
||||
/** internal, hide
|
||||
* Document.$split(text) -> [String]
|
||||
* - text (String): The text to work with
|
||||
* + ([String]): A String array, with each index containing a piece of the original `text` string.
|
||||
*
|
||||
/**
|
||||
* Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters.
|
||||
*
|
||||
* @method $split
|
||||
* @param {String} text The text to work with
|
||||
* @returns {String} A String array, with each index containing a piece of the original `text` string.
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
@@ -129,11 +119,7 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
|
||||
/** internal, hide
|
||||
* Document.$detectNewLine(text) -> Void
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
this.$detectNewLine = function(text) {
|
||||
var match = text.match(/^.*?(\r\n|\r|\n)/m);
|
||||
if (match) {
|
||||
@@ -144,12 +130,11 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.getNewLineCharacter() -> String
|
||||
* + (String): If `newLineMode == windows`, `\r\n` is returned.<br/>
|
||||
* If `newLineMode == unix`, `\n` is returned.<br/>
|
||||
* Returns the newline character that's being used, depending on the value of `newLineMode`.
|
||||
* @returns {String} If `newLineMode == windows`, `\r\n` is returned.
|
||||
* If `newLineMode == unix`, `\n` is returned.
|
||||
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
|
||||
*
|
||||
* Returns the newline character that's being used, depending on the value of `newLineMode`.
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -170,10 +155,10 @@ var Document = function(text) {
|
||||
this.$autoNewLine = "\n";
|
||||
this.$newLineMode = "auto";
|
||||
/**
|
||||
* Document.setNewLineMode(newLineMode) -> Void
|
||||
* - newLineMode(String): [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
|
||||
*
|
||||
* [Sets the new line mode.]{: #Document.setNewLineMode.desc}
|
||||
* @param {String} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.setNewLineMode = function(newLineMode) {
|
||||
if (this.$newLineMode === newLineMode)
|
||||
@@ -183,20 +168,18 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.getNewLineMode() -> String
|
||||
*
|
||||
* [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode}
|
||||
*
|
||||
* @returns String
|
||||
**/
|
||||
this.getNewLineMode = function() {
|
||||
return this.$newLineMode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.isNewLine(text) -> Boolean
|
||||
* - text (String): The text to check
|
||||
*
|
||||
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
|
||||
* @param {String} text The text to check
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.isNewLine = function(text) {
|
||||
@@ -204,10 +187,10 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.getLine(row) -> String
|
||||
* - row (Number): The row index to retrieve
|
||||
*
|
||||
* Returns a verbatim copy of the given line as it is in the document
|
||||
* @param {Number} row The row index to retrieve
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.getLine = function(row) {
|
||||
@@ -215,11 +198,11 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.getLines(firstRow, lastRow) -> [String]
|
||||
* - firstRow (Number): The first row index to retrieve
|
||||
* - lastRow (Number): The final row index to retrieve
|
||||
*
|
||||
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
|
||||
* @param {Number} firstRow The first row index to retrieve
|
||||
* @param {Number} lastRow The final row index to retrieve
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.getLines = function(firstRow, lastRow) {
|
||||
@@ -227,8 +210,6 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.getAllLines() -> [String]
|
||||
*
|
||||
* Returns all lines in the document as string array. Warning: The caller should not modify this array!
|
||||
**/
|
||||
this.getAllLines = function() {
|
||||
@@ -236,8 +217,6 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.getLength() -> Number
|
||||
*
|
||||
* Returns the number of rows in the document.
|
||||
**/
|
||||
this.getLength = function() {
|
||||
@@ -245,10 +224,10 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.getTextRange(range) -> String
|
||||
* - range (Range): The range to work with
|
||||
*
|
||||
* [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
|
||||
* @param {Range} range The range to work with
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.getTextRange = function(range) {
|
||||
if (range.start.row == range.end.row) {
|
||||
@@ -263,11 +242,6 @@ var Document = function(text) {
|
||||
}
|
||||
};
|
||||
|
||||
/** internal, hide
|
||||
* Document.$clipPosition(position) -> Number
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.$clipPosition = function(position) {
|
||||
var length = this.getLength();
|
||||
if (position.row >= length) {
|
||||
@@ -278,13 +252,11 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.insert(position, text) -> Number
|
||||
* - position (Number): The position to start inserting at
|
||||
* - text (String): A chunk of text to insert
|
||||
* + (Number): The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
|
||||
* Inserts a block of `text` and the indicated `position`.
|
||||
* @param {Object} position The position to start inserting at
|
||||
* @param {String} text A chunk of text to insert
|
||||
* @returns {Object} The position ({row, column}) of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.insert = function(position, text) {
|
||||
if (!text || text.length === 0)
|
||||
@@ -310,15 +282,42 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.insertLines(row, lines) -> Object
|
||||
* - row (Number): The index of the row to insert at
|
||||
* - lines (Array): An array of strings
|
||||
* + (Object): Returns an object containing the final row and column, like this:<br/>
|
||||
* ```{row: endRow, column: 0}```<br/>
|
||||
* If `lines` is empty, this function returns an object containing the current row, and column, like this:<br/>
|
||||
* ```{row: row, column: 0}```
|
||||
*
|
||||
* Fires whenever the document changes.
|
||||
*
|
||||
* Several methods trigger different `"change"` events. Below is a list of each action type, followed by each property that's also available:
|
||||
*
|
||||
* * `"insertLines"` (emitted by [[Document.insertLines]])
|
||||
* * `range`: the [[Range]] of the change within the document
|
||||
* * `lines`: the lines in the document that are changing
|
||||
* * `"insertText"` (emitted by [[Document.insertNewLine]])
|
||||
* * `range`: the [[Range]] of the change within the document
|
||||
* * `text`: the text that's being added
|
||||
* * `"removeLines"` (emitted by [[Document.insertLines]])
|
||||
* * `range`: the [[Range]] of the change within the document
|
||||
* * `lines`: the lines in the document that were removed
|
||||
* * `nl`: the new line character (as defined by [[Document.getNewLineCharacter]])
|
||||
* * `"removeText"` (emitted by [[Document.removeInLine]] and [[Document.removeNewLine]])
|
||||
* * `range`: the [[Range]] of the change within the document
|
||||
* * `text`: the text that's being removed
|
||||
*
|
||||
* @event change
|
||||
* @param {Object} e Contains at least one property called `"action"`. `"action"` indicates the action that triggered the change. Each action also has a set of additional properties.
|
||||
*
|
||||
**/
|
||||
/**
|
||||
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
|
||||
* @param {Number} row The index of the row to insert at
|
||||
* @param {Array} lines An array of strings
|
||||
* @returns {Object} Contains the final row and column, like this:
|
||||
* ```
|
||||
* {row: endRow, column: 0}
|
||||
* ```
|
||||
* If `lines` is empty, this function returns an object containing the current row, and column, like this:
|
||||
* ```
|
||||
* {row: row, column: 0}
|
||||
* ```
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
@@ -348,14 +347,12 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.insertNewLine(position) -> Object
|
||||
* - position (String): The position to insert at
|
||||
* + (Object): Returns an object containing the final row and column, like this:<br/>
|
||||
* ```{row: endRow, column: 0}```
|
||||
*
|
||||
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
|
||||
*
|
||||
*
|
||||
* @param {Object} position The position to insert at
|
||||
* @returns {Object} Returns an object containing the final row and column, like this:<br/>
|
||||
* ```
|
||||
* {row: endRow, column: 0}
|
||||
* ```
|
||||
*
|
||||
**/
|
||||
this.insertNewLine = function(position) {
|
||||
@@ -381,16 +378,13 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.insertInLine(position, text) -> Object | Number
|
||||
* - position (Number): The position to insert at
|
||||
* - text (String): A chunk of text
|
||||
* + (Object): Returns an object containing the final row and column, like this:<br/>
|
||||
* ```{row: endRow, column: 0}```
|
||||
* + (Number): If `text` is empty, this function returns the value of `position`
|
||||
*
|
||||
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
|
||||
*
|
||||
*
|
||||
* @param {Object} position The position to insert at
|
||||
* @param {String} text A chunk of text
|
||||
* @returns {Object} Returns an object containing the final row and column, like this:
|
||||
* ```
|
||||
* {row: endRow, column: 0}
|
||||
* ```
|
||||
*
|
||||
**/
|
||||
this.insertInLine = function(position, text) {
|
||||
@@ -418,11 +412,9 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.remove(range) -> Object
|
||||
* - range (Range): A specified Range to remove
|
||||
* + (Object): Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
|
||||
*
|
||||
* Removes the `range` from the document.
|
||||
* @param {Range} range A specified Range to remove
|
||||
* @returns {Object} Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
|
||||
*
|
||||
*
|
||||
**/
|
||||
@@ -459,13 +451,11 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.removeInLine(row, startColumn, endColumn) -> Object
|
||||
* - row (Number): The row to remove from
|
||||
* - startColumn (Number): The column to start removing at
|
||||
* - endColumn (Number): The column to stop removing at
|
||||
* + (Object): Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.<br/>If `startColumn` is equal to `endColumn`, this function returns nothing.
|
||||
*
|
||||
* Removes the specified columns from the `row`. This method also triggers the `'change'` event.
|
||||
* @param {Number} row The row to remove from
|
||||
* @param {Number} startColumn The column to start removing at
|
||||
* @param {Number} endColumn The column to stop removing at
|
||||
* @returns {Object} Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.<br/>If `startColumn` is equal to `endColumn`, this function returns nothing.
|
||||
*
|
||||
*
|
||||
**/
|
||||
@@ -489,12 +479,10 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.removeLines(firstRow, lastRow) -> [String]
|
||||
* - firstRow (Number): The first row to be removed
|
||||
* - lastRow (Number): The last row to be removed
|
||||
* + ([String]): Returns all the removed lines.
|
||||
*
|
||||
* Removes a range of full lines. This method also triggers the `'change'` event.
|
||||
* @param {Number} firstRow The first row to be removed
|
||||
* @param {Number} lastRow The last row to be removed
|
||||
* @returns {[String]} Returns all the removed lines.
|
||||
*
|
||||
*
|
||||
**/
|
||||
@@ -513,10 +501,8 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.removeNewLine(row) -> Void
|
||||
* - row (Number): The row to check
|
||||
*
|
||||
* Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event.
|
||||
* @param {Number} row The row to check
|
||||
*
|
||||
**/
|
||||
this.removeNewLine = function(row) {
|
||||
@@ -537,15 +523,14 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.replace(range, text) -> Object
|
||||
* - range (Range): A specified Range to replace
|
||||
* - text (String): The new text to use as a replacement
|
||||
* + (Object): Returns an object containing the final row and column, like this:
|
||||
* Replaces a range in the document with the new `text`.
|
||||
* @param {Range} range A specified Range to replace
|
||||
* @param {String} text The new text to use as a replacement
|
||||
* @returns {Object} Returns an object containing the final row and column, like this:
|
||||
* {row: endRow, column: 0}
|
||||
* If the text and range are empty, this function returns an object containing the current `range.start` value.
|
||||
* If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
|
||||
*
|
||||
* Replaces a range in the document with the new `text`.
|
||||
*
|
||||
**/
|
||||
this.replace = function(range, text) {
|
||||
@@ -569,8 +554,6 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.applyDeltas(deltas) -> Void
|
||||
*
|
||||
* Applies all the changes previously accumulated. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
|
||||
**/
|
||||
this.applyDeltas = function(deltas) {
|
||||
@@ -590,8 +573,6 @@ var Document = function(text) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Document.revertDeltas(deltas) -> Void
|
||||
*
|
||||
* Reverts any changes previously applied. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
|
||||
**/
|
||||
this.revertDeltas = function(deltas) {
|
||||
|
||||
@@ -1,38 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+30
-63
@@ -1,38 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -42,38 +34,13 @@ define(function(require, exports, module) {
|
||||
var TokenIterator = require("../token_iterator").TokenIterator;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
/**
|
||||
* class BracketMatch
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new BracketMatch(position)
|
||||
* - platform (String): Identifier for the platform; must be either `'mac'` or `'win'`
|
||||
* - commands (Array): A list of commands
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
*
|
||||
**/
|
||||
function BracketMatch() {
|
||||
|
||||
/**
|
||||
* new findMatchingBracket(position)
|
||||
* - position (Number): Identifier for the platform; must be either `'mac'` or `'win'`
|
||||
* - commands (Array): A list of commands
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.findMatchingBracket = function(position) {
|
||||
this.findMatchingBracket = function(position, char) {
|
||||
if (position.column == 0) return null;
|
||||
|
||||
var charBeforeCursor = this.getLine(position.row).charAt(position.column-1);
|
||||
var charBeforeCursor = char || this.getLine(position.row).charAt(position.column-1);
|
||||
if (charBeforeCursor == "") return null;
|
||||
|
||||
var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
|
||||
@@ -144,7 +111,7 @@ function BracketMatch() {
|
||||
if (!token)
|
||||
token = iterator.stepForward();
|
||||
if (!token)
|
||||
return
|
||||
return;
|
||||
|
||||
if (!typeRe){
|
||||
typeRe = new RegExp(
|
||||
@@ -200,7 +167,7 @@ function BracketMatch() {
|
||||
if (!token)
|
||||
token = iterator.stepForward();
|
||||
if (!token)
|
||||
return
|
||||
return;
|
||||
|
||||
if (!typeRe){
|
||||
typeRe = new RegExp(
|
||||
|
||||
@@ -1,38 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Julian Viereck <julian DOT viereck AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -91,7 +83,7 @@ var Fold = exports.Fold = function(range, placeholder) {
|
||||
var afterStart = this.subFolds[i];
|
||||
|
||||
if (cmp == 0)
|
||||
return afterStart.addSubFold(fold)
|
||||
return afterStart.addSubFold(fold);
|
||||
|
||||
// cmp == -1
|
||||
var row = fold.range.end.row, column = fold.range.end.column;
|
||||
@@ -105,11 +97,11 @@ var Fold = exports.Fold = function(range, placeholder) {
|
||||
if (cmp == 0)
|
||||
throw "A fold can't intersect already existing fold" + fold.range + this.range;
|
||||
|
||||
var consumedFolds = this.subFolds.splice(i, j - i, fold)
|
||||
var consumedFolds = this.subFolds.splice(i, j - i, fold);
|
||||
fold.setFoldLine(this.foldLine);
|
||||
|
||||
return fold;
|
||||
}
|
||||
};
|
||||
|
||||
}).call(Fold.prototype);
|
||||
|
||||
|
||||
+27
-35
@@ -1,38 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Julian Viereck <julian DOT viereck AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -178,7 +170,7 @@ function FoldLine(foldData, folds) {
|
||||
&& fold.start.row != row)
|
||||
{
|
||||
//throwing here breaks whole editor
|
||||
//@todo properly handle this
|
||||
//TODO: properly handle this
|
||||
window.console && window.console.log(row, column, fold);
|
||||
} else if (fold.start.row == row) {
|
||||
folds = this.folds;
|
||||
|
||||
+47
-55
@@ -1,38 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Julian Viereck <julian DOT viereck AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -282,9 +274,6 @@ function Folding() {
|
||||
var endColumn = fold.end.column;
|
||||
|
||||
// --- Some checking ---
|
||||
if (fold.placeholder.length < 2)
|
||||
throw "Placeholder has to be at least 2 characters";
|
||||
|
||||
if (startRow == endRow && endColumn - startColumn < 2)
|
||||
throw "The range has to be at least 2 characters width";
|
||||
|
||||
@@ -470,9 +459,7 @@ function Folding() {
|
||||
|
||||
this.getRowFoldEnd = function(docRow, startFoldRow) {
|
||||
var foldLine = this.getFoldLine(docRow, startFoldRow);
|
||||
return (foldLine
|
||||
? foldLine.end.row
|
||||
: docRow);
|
||||
return foldLine ? foldLine.end.row : docRow;
|
||||
};
|
||||
|
||||
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
|
||||
@@ -499,7 +486,7 @@ function Folding() {
|
||||
}
|
||||
lastColumn = Math.max(startColumn, lastColumn);
|
||||
}
|
||||
if (placeholder) {
|
||||
if (placeholder != null) {
|
||||
textLine += placeholder;
|
||||
} else {
|
||||
textLine += doc.getLine(row).substring(lastColumn, column);
|
||||
@@ -598,30 +585,34 @@ function Folding() {
|
||||
this.addFold(placeholder, range);
|
||||
};
|
||||
|
||||
this.getCommentFoldRange = function(row, column) {
|
||||
this.getCommentFoldRange = function(row, column, dir) {
|
||||
var iterator = new TokenIterator(this, row, column);
|
||||
var token = iterator.getCurrentToken();
|
||||
if (token && /^comment|string/.test(token.type)) {
|
||||
var range = new Range();
|
||||
var re = new RegExp(token.type.replace(/\..*/, "\\."));
|
||||
do {
|
||||
token = iterator.stepBackward();
|
||||
} while(token && re.test(token.type));
|
||||
|
||||
iterator.stepForward();
|
||||
if (dir != 1) {
|
||||
do {
|
||||
token = iterator.stepBackward();
|
||||
} while(token && re.test(token.type));
|
||||
iterator.stepForward();
|
||||
}
|
||||
|
||||
range.start.row = iterator.getCurrentTokenRow();
|
||||
range.start.column = iterator.getCurrentTokenColumn() + 2;
|
||||
|
||||
iterator = new TokenIterator(this, row, column);
|
||||
|
||||
do {
|
||||
token = iterator.stepForward();
|
||||
} while(token && re.test(token.type));
|
||||
|
||||
token = iterator.stepBackward();
|
||||
if (dir != -1) {
|
||||
do {
|
||||
token = iterator.stepForward();
|
||||
} while(token && re.test(token.type));
|
||||
token = iterator.stepBackward();
|
||||
} else
|
||||
token = iterator.getCurrentToken();
|
||||
|
||||
range.end.row = iterator.getCurrentTokenRow();
|
||||
range.end.column = iterator.getCurrentTokenColumn() + token.value.length;
|
||||
range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2;
|
||||
return range;
|
||||
}
|
||||
};
|
||||
@@ -638,7 +629,7 @@ function Folding() {
|
||||
var range = this.getFoldWidgetRange(row);
|
||||
// sometimes range can be incompatible with existing fold
|
||||
// wouldn't it be better for addFold to return null istead of throwing?
|
||||
if (range && range.end.row < endRow) try {
|
||||
if (range && range.end.row <= endRow) try {
|
||||
this.addFold("...", range);
|
||||
} catch(e) {}
|
||||
}
|
||||
@@ -693,6 +684,7 @@ function Folding() {
|
||||
};
|
||||
|
||||
this.onFoldWidgetClick = function(row, e) {
|
||||
e = e.domEvent;
|
||||
var type = this.getFoldWidget(row);
|
||||
var line = this.getLine(row);
|
||||
var onlySubfolds = e.shiftKey;
|
||||
@@ -731,7 +723,7 @@ function Folding() {
|
||||
} else {
|
||||
if (addSubfolds)
|
||||
this.foldAll(row + 1, this.getLength());
|
||||
e.target.className += " invalid"
|
||||
(e.target || e.srcElement).className += " ace_invalid"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,38 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian DOT viereck AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -69,6 +61,13 @@ function createFoldTestSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
function assertArray(a, b) {
|
||||
assert.ok(a.length == b.length);
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
assert.equal(a[i], b[i]);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
"test: find matching opening bracket in Text mode" : function() {
|
||||
@@ -808,13 +807,6 @@ module.exports = {
|
||||
},
|
||||
|
||||
"test fold wrap data compution": function() {
|
||||
function assertArray(a, b) {
|
||||
assert.ok(a.length == b.length);
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
assert.equal(a[i], b[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function assertWrap(line0, line1, line2) {
|
||||
line0 && assertArray(wrapData[0], line0);
|
||||
line1 && assertArray(wrapData[1], line1);
|
||||
@@ -928,7 +920,7 @@ module.exports = {
|
||||
tryAddFold("foo", new Range(0, 13, 0, 18), false);
|
||||
assert.equal(session.$foldData[0].folds.length, 1);
|
||||
|
||||
tryAddFold("f", new Range(0, 13, 0, 18), true);
|
||||
tryAddFold("f", new Range(0, 13, 0, 18), false);
|
||||
tryAddFold("foo", new Range(0, 18, 0, 21), false);
|
||||
assert.equal(session.$foldData[0].folds.length, 2);
|
||||
session.removeFold(fold);
|
||||
@@ -971,6 +963,34 @@ module.exports = {
|
||||
session.addFold("fold0", new Range(0, 1, 0, 5));
|
||||
session.addFold("fold0", new Range(0, 6, 0, 8));
|
||||
assert.equal(fold.subFolds.length, 2);
|
||||
},
|
||||
|
||||
"test row cache": function() {
|
||||
var session = createFoldTestSession();
|
||||
|
||||
session.screenToDocumentPosition(2,3);
|
||||
assertArray(session.$docRowCache, [1,3]);
|
||||
assertArray(session.$screenRowCache, [1,2]);
|
||||
|
||||
session.screenToDocumentPosition(5,3);
|
||||
assertArray(session.$docRowCache, [1,3,4]);
|
||||
assertArray(session.$screenRowCache, [1,2,3]);
|
||||
|
||||
session.screenToDocumentPosition(0,3);
|
||||
assertArray(session.$docRowCache, [1,3,4]);
|
||||
assertArray(session.$screenRowCache, [1,2,3]);
|
||||
|
||||
session.screenToDocumentPosition(0,0);
|
||||
assertArray(session.$docRowCache, [1,3,4]);
|
||||
assertArray(session.$screenRowCache, [1,2,3]);
|
||||
|
||||
session.screenToDocumentPosition(1,0);
|
||||
assertArray(session.$docRowCache, [1,3,4]);
|
||||
assertArray(session.$screenRowCache, [1,2,3]);
|
||||
|
||||
session.$resetRowCache();
|
||||
assertArray(session.$docRowCache, []);
|
||||
assertArray(session.$screenRowCache, []);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+25
-32
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
+26
-34
@@ -1,38 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mihai Sucan.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
+25
-32
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
+25
-32
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
+28
-38
@@ -1,39 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jan Jongboom <fabian AT ajax DOT org>
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -70,13 +61,12 @@ exports.render = function(input, mode, theme, lineStart, disableGutter) {
|
||||
|
||||
var stringBuilder = [];
|
||||
var length = session.getLength();
|
||||
|
||||
|
||||
for(var ix = 0; ix < length; ix++) {
|
||||
var lineTokens = session.getTokens(ix);
|
||||
stringBuilder.push("<div class='ace_line'>");
|
||||
if (!disableGutter)
|
||||
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
|
||||
textLayer.$renderLine(stringBuilder, 0, lineTokens, true);
|
||||
textLayer.$renderLine(stringBuilder, ix, true, false);
|
||||
stringBuilder.push("</div>");
|
||||
}
|
||||
|
||||
|
||||
+9
-14
@@ -16,7 +16,8 @@ module.exports = {
|
||||
|
||||
"test simple snippet": function(next) {
|
||||
var theme = require("../theme/tomorrow");
|
||||
var snippet = "/** this is a function\n\
|
||||
var snippet = "\
|
||||
/** this is a function\n\
|
||||
*\n\
|
||||
*/\n\
|
||||
function hello (a, b, c) {\n\
|
||||
@@ -24,23 +25,16 @@ function hello (a, b, c) {\n\
|
||||
}";
|
||||
var mode = new JavaScriptMode();
|
||||
|
||||
var isError = false, result;
|
||||
try {
|
||||
result = highlighter.render(snippet, mode, theme);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e);
|
||||
isError = true;
|
||||
}
|
||||
// todo: write something more meaningful
|
||||
assert.equal(isError, false);
|
||||
|
||||
var result = highlighter.render(snippet, mode, theme);
|
||||
assert.equal(result.html, "<div class='ace-tomorrow'> <div class='ace_editor ace_scroller ace_text-layer'> <div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>1</span><span class='ace_comment ace_doc'>/** this is a function</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>2</span><span class='ace_comment ace_doc'>*</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>3</span><span class='ace_comment ace_doc'>*/</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>4</span><span class='ace_storage ace_type'>function</span> <span class='ace_entity ace_name ace_function'>hello</span> <span class='ace_paren ace_lparen'>(</span><span class='ace_variable ace_parameter'>a</span><span class='ace_punctuation ace_operator'>, </span><span class='ace_variable ace_parameter'>b</span><span class='ace_punctuation ace_operator'>, </span><span class='ace_variable ace_parameter'>c</span><span class='ace_paren ace_rparen'>)</span> <span class='ace_paren ace_lparen'>{</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>5</span>    <span class='ace_storage ace_type'>console</span><span class='ace_punctuation ace_operator'>.</span><span class='ace_support ace_function ace_firebug'>log</span><span class='ace_paren ace_lparen'>(</span><span class='ace_identifier'>a</span> <span class='ace_keyword ace_operator'>*</span> <span class='ace_identifier'>b</span> <span class='ace_keyword ace_operator'>+</span> <span class='ace_identifier'>c</span> <span class='ace_keyword ace_operator'>+</span> <span class='ace_string'>'sup?'</span><span class='ace_paren ace_rparen'>)</span><span class='ace_punctuation ace_operator'>;</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>6</span><span class='ace_paren ace_rparen'>}</span></div> </div> </div>");
|
||||
assert.ok(!!result.css);
|
||||
next();
|
||||
},
|
||||
|
||||
"test css from theme is used": function(next) {
|
||||
var theme = require("../theme/tomorrow");
|
||||
var snippet = "/** this is a function\n\
|
||||
var snippet = "\
|
||||
/** this is a function\n\
|
||||
*\n\
|
||||
*/\n\
|
||||
function hello (a, b, c) {\n\
|
||||
@@ -58,7 +52,8 @@ function hello (a, b, c) {\n\
|
||||
|
||||
"test theme classname should be in output html": function (next) {
|
||||
var theme = require("../theme/tomorrow");
|
||||
var snippet = "/** this is a function\n\
|
||||
var snippet = "\
|
||||
/** this is a function\n\
|
||||
*\n\
|
||||
*/\n\
|
||||
function hello (a, b, c) {\n\
|
||||
|
||||
@@ -1,39 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Skywriter.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Kevin Dangoor (kdangoor@mozilla.com)
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
* Harutyun Amirjanyan [harutyun@c9.io]
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -45,7 +36,7 @@ var UA = require("../lib/useragent");
|
||||
var net = require("../lib/net");
|
||||
var ace = require("../ace");
|
||||
|
||||
require("ace/theme/textmate");
|
||||
require("../theme/textmate");
|
||||
|
||||
module.exports = exports = ace;
|
||||
|
||||
@@ -193,7 +184,6 @@ exports.transformTextarea = function(element, loader) {
|
||||
var settingOpener = document.createElement("div");
|
||||
applyStyles(settingOpener, {
|
||||
position: "absolute",
|
||||
width: "15px",
|
||||
right: "0px",
|
||||
bottom: "0px",
|
||||
background: "red",
|
||||
|
||||
@@ -1,38 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Skywriter.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Julian Viereck (julian.viereck@gmail.com)
|
||||
* Harutyun Amirjanyan (harutyun@c9.io)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -65,6 +57,7 @@ exports.handler.attach = function(editor) {
|
||||
.emacs-mode .ace_cursor{\
|
||||
border: 2px rgba(50,250,50,0.8) solid!important;\
|
||||
-moz-box-sizing: border-box!important;\
|
||||
-webkit-box-sizing: border-box!important;\
|
||||
box-sizing: border-box!important;\
|
||||
background-color: rgba(0,250,0,0.9);\
|
||||
opacity: 0.5;\
|
||||
@@ -73,7 +66,7 @@ exports.handler.attach = function(editor) {
|
||||
opacity: 1;\
|
||||
background-color: transparent;\
|
||||
}\
|
||||
.emacs-mode .ace_cursor.ace_overwrite {\
|
||||
.emacs-mode .ace_overwrite-cursors .ace_cursor {\
|
||||
opacity: 1;\
|
||||
background-color: transparent;\
|
||||
border-width: 0 0 2px 2px !important;\
|
||||
@@ -220,7 +213,8 @@ exports.emacsKeys = {
|
||||
"S-C-Home" : "selecttostart",
|
||||
"S-C-End" : "selecttoend",
|
||||
|
||||
"C-l|M-s" : "centerselection",
|
||||
"C-l" : "recenterTopBottom",
|
||||
"M-s" : "centerselection",
|
||||
"M-g": "gotoline",
|
||||
"C-x C-p": "selectall",
|
||||
|
||||
@@ -278,6 +272,20 @@ exports.emacsKeys = {
|
||||
exports.handler.bindKeys(exports.emacsKeys);
|
||||
|
||||
exports.handler.addCommands({
|
||||
recenterTopBottom: function(editor) {
|
||||
var renderer = editor.renderer;
|
||||
var pos = renderer.$cursorLayer.getPixelPosition();
|
||||
var h = renderer.$size.scrollerHeight - renderer.lineHeight;
|
||||
var scrollTop = renderer.scrollTop;
|
||||
if (Math.abs(pos.top - scrollTop) < 2) {
|
||||
scrollTop = pos.top - h;
|
||||
} else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) {
|
||||
scrollTop = pos.top;
|
||||
} else {
|
||||
scrollTop = pos.top - h * 0.5;
|
||||
}
|
||||
editor.session.setScrollTop(scrollTop);
|
||||
},
|
||||
selectRectangularRegion: function(editor) {
|
||||
editor.multiSelect.toggleBlockSelection();
|
||||
},
|
||||
@@ -331,7 +339,7 @@ exports.handler.addCommands({
|
||||
},
|
||||
killRegion: function(editor) {
|
||||
exports.killRing.add(editor.getCopyText());
|
||||
editor.cut();
|
||||
editor.commands.byName.cut.exec(editor);
|
||||
},
|
||||
killRingSave: function(editor) {
|
||||
exports.killRing.add(editor.getCopyText());
|
||||
|
||||
+46
-53
@@ -1,38 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Skywriter.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck (julian.viereck@gmail.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -129,33 +121,34 @@ function HashHandler(config, platform) {
|
||||
var key = typeof binding == "string" ? binding: binding[this.platform];
|
||||
this.bindKey(key, command);
|
||||
};
|
||||
|
||||
|
||||
// accepts keys in the form ctrl+Enter or ctrl-Enter
|
||||
// keys without modifiers or shift only
|
||||
this.parseKeys = function(keys) {
|
||||
var key;
|
||||
var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x});
|
||||
var key = parts.pop();
|
||||
|
||||
var keyCode = keyUtil[key];
|
||||
if (keyUtil.FUNCTION_KEYS[keyCode])
|
||||
key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase();
|
||||
else if (!parts.length)
|
||||
return {key: key, hashId: -1};
|
||||
else if (parts.length == 1 && parts[0] == "shift")
|
||||
return {key: key.toUpperCase(), hashId: -1};
|
||||
|
||||
var hashId = 0;
|
||||
var parts = keys.toLowerCase().trim().split(/\s*\-\s*/);
|
||||
|
||||
for (var i = 0, l = parts.length; i < l; i++) {
|
||||
if (keyUtil.KEY_MODS[parts[i]])
|
||||
hashId = hashId | keyUtil.KEY_MODS[parts[i]];
|
||||
else
|
||||
key = parts[i] || "-"; //when empty, the splitSafe removed a '-'
|
||||
for (var i = parts.length; i--;) {
|
||||
var modifier = keyUtil.KEY_MODS[parts[i]];
|
||||
if (modifier == null)
|
||||
throw "invalid modifier " + parts[i] + " in " + keys;
|
||||
hashId |= modifier;
|
||||
}
|
||||
|
||||
if (parts[0] == "text" && parts.length == 2) {
|
||||
hashId = -1;
|
||||
key = parts[1];
|
||||
}
|
||||
|
||||
return {
|
||||
key: key,
|
||||
hashId: hashId
|
||||
};
|
||||
return {key: key, hashId: hashId};
|
||||
};
|
||||
|
||||
this.findKeyCommand = function findKeyCommand(hashId, keyString) {
|
||||
var ckbr = this.commmandKeyBinding;
|
||||
return ckbr[hashId] && ckbr[hashId][keyString.toLowerCase()];
|
||||
return ckbr[hashId] && ckbr[hashId][keyString];
|
||||
};
|
||||
|
||||
this.handleKeyboard = function(data, hashId, keyString, keyCode) {
|
||||
|
||||
+25
-34
@@ -1,39 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
* Harutyun Amirjanyan <amirjanyan@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
+26
-33
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Skywriter.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Julian Viereck (julian.viereck@gmail.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -109,7 +102,7 @@ StateHandler.prototype = {
|
||||
};
|
||||
|
||||
if (e) {
|
||||
bufferObj.keyIdentifier = e.keyIdentifier
|
||||
bufferObj.keyIdentifier = e.keyIdentifier;
|
||||
}
|
||||
|
||||
return bufferObj;
|
||||
|
||||
+235
-170
@@ -1,39 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Mihai Sucan <mihai DOT sucan AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -46,6 +37,7 @@ var dom = require("../lib/dom");
|
||||
|
||||
var TextInput = function(parentNode, host) {
|
||||
var text = dom.createElement("textarea");
|
||||
text.className = "ace_text-input";
|
||||
/*/ debug
|
||||
text.style.opacity = 1
|
||||
text.style.background = "rgba(0, 250, 0, 0.3)"
|
||||
@@ -55,71 +47,109 @@ var TextInput = function(parentNode, host) {
|
||||
if (useragent.isTouchPad)
|
||||
text.setAttribute("x-palm-disable-auto-cap", true);
|
||||
|
||||
text.setAttribute("wrap", "off");
|
||||
text.wrap = "off";
|
||||
text.spellcheck = false;
|
||||
|
||||
text.style.top = "-2em";
|
||||
parentNode.insertBefore(text, parentNode.firstChild);
|
||||
|
||||
var PLACEHOLDER = useragent.isIE ? "\x01" : "\x01";
|
||||
sendText();
|
||||
var PLACEHOLDER = useragent.isIE || useragent.isOpera ? "\x01\x01" : "\x00\x00";
|
||||
|
||||
var inCompostion = false;
|
||||
resetValue();
|
||||
|
||||
if (isFocused())
|
||||
host.onFocus();
|
||||
|
||||
// Somehow fixes problem with firing onpropertychange on first typed char
|
||||
if (useragent.isOldIE) {
|
||||
resetSelection();
|
||||
resetValue();
|
||||
setTimeout(resetSelection);
|
||||
}
|
||||
|
||||
var cut = false
|
||||
var copied = false;
|
||||
var pasted = false;
|
||||
|
||||
var inCompostion = false;
|
||||
|
||||
var resetTimeout = null;
|
||||
|
||||
var tempStyle = '';
|
||||
|
||||
function reset(full) {
|
||||
try {
|
||||
if (full) {
|
||||
function resetValue() {
|
||||
text.value = PLACEHOLDER;
|
||||
//http://code.google.com/p/chromium/issues/detail?id=76516
|
||||
if (useragent.isWebKit && !resetTimeout)
|
||||
resetTimeout = setTimeout(function(){
|
||||
text.value = PLACEHOLDER;
|
||||
text.selectionStart = 0;
|
||||
text.selectionEnd = 1;
|
||||
} else
|
||||
text.select();
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function sendText(valueToSend) {
|
||||
if (!copied) {
|
||||
var value = valueToSend || text.value;
|
||||
if (value) {
|
||||
if (value.length > 1) {
|
||||
if (value.charAt(0) == PLACEHOLDER)
|
||||
value = value.substr(1);
|
||||
else if (value.charAt(value.length - 1) == PLACEHOLDER)
|
||||
value = value.slice(0, -1);
|
||||
}
|
||||
|
||||
if (value && value != PLACEHOLDER) {
|
||||
if (pasted)
|
||||
host.onPaste(value);
|
||||
else
|
||||
host.onTextInput(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
copied = false;
|
||||
pasted = false;
|
||||
|
||||
// Safari doesn't fire copy events if no text is selected
|
||||
reset(true);
|
||||
}
|
||||
|
||||
var onTextInput = function(e) {
|
||||
if (!inCompostion)
|
||||
sendText(e.data);
|
||||
setTimeout(function () {
|
||||
if (!inCompostion)
|
||||
reset(true);
|
||||
}, 0);
|
||||
resetSelection();
|
||||
resetTimeout = null;
|
||||
});
|
||||
};
|
||||
|
||||
var onPropertyChange = function(e) {
|
||||
setTimeout(function() {
|
||||
if (!inCompostion)
|
||||
sendText();
|
||||
}, 0);
|
||||
function resetSelection(isEmpty) {
|
||||
var selectionStart = isEmpty ? 2 : 1;
|
||||
var selectionEnd = 2;
|
||||
// on firefox this throws if textarea is hidden
|
||||
try {
|
||||
if (text.setSelectionRange) {
|
||||
text.setSelectionRange(selectionStart, selectionEnd);
|
||||
}
|
||||
// IE8 does not support setSelectionRange
|
||||
else if (text.createTextRange) {
|
||||
var range = text.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', selectionEnd);
|
||||
range.moveStart('character', selectionStart);
|
||||
range.select();
|
||||
}
|
||||
} catch(e){}
|
||||
};
|
||||
|
||||
var onSelect = function(e) {
|
||||
if (cut) {
|
||||
cut = false;
|
||||
return;
|
||||
}
|
||||
if (copied) {
|
||||
copied = false;
|
||||
return;
|
||||
}
|
||||
if (text.selectionStart === 0 && text.selectionEnd === text.value.length) {
|
||||
host.selectAll();
|
||||
resetSelection();
|
||||
}
|
||||
};
|
||||
|
||||
var onInput = function(e) {
|
||||
if (inCompostion)
|
||||
return;
|
||||
|
||||
if (pasted) {
|
||||
var data = text.value;
|
||||
resetValue();
|
||||
if (data)
|
||||
host.onPaste(data);
|
||||
pasted = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var data = text.value;
|
||||
if (data.substring(0, 2) == PLACEHOLDER)
|
||||
data = data.substr(2);
|
||||
else
|
||||
data = data.substr(1);
|
||||
|
||||
resetValue();
|
||||
if (data) {
|
||||
// can happen if undo in textarea isn't stopped
|
||||
if (data[data.length - 1] == PLACEHOLDER[0])
|
||||
data = data.slice(0, -1);
|
||||
if (data)
|
||||
host.onTextInput(data);
|
||||
} else
|
||||
host.onDelete();
|
||||
};
|
||||
|
||||
var onCompositionStart = function(e) {
|
||||
@@ -138,93 +168,130 @@ var TextInput = function(parentNode, host) {
|
||||
host.onCompositionEnd();
|
||||
};
|
||||
|
||||
var onCopy = function(e) {
|
||||
copied = true;
|
||||
var copyText = host.getCopyText();
|
||||
if(copyText)
|
||||
text.value = copyText;
|
||||
else
|
||||
e.preventDefault();
|
||||
reset();
|
||||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
var onCut = function(e) {
|
||||
var data = host.getCopyText();
|
||||
if (!data) {
|
||||
event.preventDefault(e);
|
||||
return;
|
||||
}
|
||||
|
||||
var clipboardData = e.clipboardData || window.clipboardData;
|
||||
|
||||
if (clipboardData) {
|
||||
// Safari 5 has clipboardData object, but does not handle setData()
|
||||
var supported = clipboardData.setData("Text", data);
|
||||
if (supported) {
|
||||
host.onCut();
|
||||
event.preventDefault(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (!supported) {
|
||||
cut = true;
|
||||
text.value = data;
|
||||
text.select();
|
||||
setTimeout(function(){
|
||||
cut = false;
|
||||
resetValue();
|
||||
resetSelection();
|
||||
host.onCut();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var onCut = function(e) {
|
||||
copied = true;
|
||||
var copyText = host.getCopyText();
|
||||
if(copyText) {
|
||||
text.value = copyText;
|
||||
host.onCut();
|
||||
} else
|
||||
e.preventDefault();
|
||||
reset();
|
||||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
var onCopy = function(e) {
|
||||
var data = host.getCopyText();
|
||||
if (!data) {
|
||||
event.preventDefault(e);
|
||||
return;
|
||||
}
|
||||
|
||||
var clipboardData = e.clipboardData || window.clipboardData;
|
||||
|
||||
if (clipboardData) {
|
||||
// Safari 5 has clipboardData object, but does not handle setData()
|
||||
var supported = clipboardData.setData("Text", data);
|
||||
if (supported) {
|
||||
host.onCopy();
|
||||
event.preventDefault(e);
|
||||
}
|
||||
}
|
||||
if (!supported) {
|
||||
copied = true;
|
||||
text.value = data;
|
||||
text.select();
|
||||
setTimeout(function(){
|
||||
copied = false;
|
||||
resetValue();
|
||||
resetSelection();
|
||||
host.onCopy();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
var onPaste = function(e) {
|
||||
var clipboardData = e.clipboardData || window.clipboardData;
|
||||
|
||||
if (clipboardData) {
|
||||
var data = clipboardData.getData("Text");
|
||||
if (data)
|
||||
host.onPaste(data);
|
||||
event.preventDefault(e);
|
||||
}
|
||||
else {
|
||||
text.value = "";
|
||||
pasted = true;
|
||||
}
|
||||
};
|
||||
|
||||
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
|
||||
event.addListener(text, "input", useragent.isIE ? onPropertyChange : onTextInput);
|
||||
|
||||
event.addListener(text, "paste", function(e) {
|
||||
// Mark that the next input text comes from past.
|
||||
pasted = true;
|
||||
// Some browsers support the event.clipboardData API. Use this to get
|
||||
// the pasted content which increases speed if pasting a lot of lines.
|
||||
if (e.clipboardData && e.clipboardData.getData) {
|
||||
sendText(e.clipboardData.getData("text/plain"));
|
||||
e.preventDefault();
|
||||
}
|
||||
else {
|
||||
// If a browser doesn't support any of the things above, use the regular
|
||||
// method to detect the pasted input.
|
||||
onPropertyChange();
|
||||
}
|
||||
});
|
||||
event.addListener(text, "select", onSelect);
|
||||
|
||||
if ("onbeforecopy" in text && typeof clipboardData !== "undefined") {
|
||||
event.addListener(text, "beforecopy", function(e) {
|
||||
if (tempStyle)
|
||||
return; // without this text is copied when contextmenu is shown
|
||||
var copyText = host.getCopyText();
|
||||
if (copyText)
|
||||
clipboardData.setData("Text", copyText);
|
||||
else
|
||||
e.preventDefault();
|
||||
});
|
||||
event.addListener(parentNode, "keydown", function(e) {
|
||||
if (e.ctrlKey && e.keyCode == 88) {
|
||||
var copyText = host.getCopyText();
|
||||
if (copyText) {
|
||||
clipboardData.setData("Text", copyText);
|
||||
host.onCut();
|
||||
}
|
||||
event.preventDefault(e);
|
||||
}
|
||||
});
|
||||
event.addListener(text, "cut", onCut); // for ie9 context menu
|
||||
}
|
||||
else if (useragent.isOpera) {
|
||||
event.addListener(text, "input", onInput);
|
||||
|
||||
event.addListener(text, "cut", onCut);
|
||||
event.addListener(text, "copy", onCopy);
|
||||
event.addListener(text, "paste", onPaste);
|
||||
|
||||
|
||||
// Opera has no clipboard events
|
||||
if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)){
|
||||
event.addListener(parentNode, "keydown", function(e) {
|
||||
if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
|
||||
return;
|
||||
return;
|
||||
|
||||
if ((e.keyCode == 88 || e.keyCode == 67)) {
|
||||
var copyText = host.getCopyText();
|
||||
if (copyText) {
|
||||
text.value = copyText;
|
||||
text.select();
|
||||
if (e.keyCode == 88)
|
||||
host.onCut();
|
||||
}
|
||||
switch (e.keyCode) {
|
||||
case 67:
|
||||
onCopy(e);
|
||||
break;
|
||||
case 86:
|
||||
onPaste(e);
|
||||
break;
|
||||
case 88:
|
||||
onCut(e);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
event.addListener(text, "copy", onCopy);
|
||||
event.addListener(text, "cut", onCut);
|
||||
|
||||
if (useragent.isOldIE) {
|
||||
event.addListener(text, "propertychange", function(e){
|
||||
if (text.value != "" && text.value != PLACEHOLDER)
|
||||
onInput(e);
|
||||
});
|
||||
|
||||
var keytable = { 13:1, 27:1 };
|
||||
event.addListener(text, "keyup", function (e) {
|
||||
if (inCompostion && (!text.value || keytable[e.keyCode]))
|
||||
setTimeout(onCompositionEnd, 0);
|
||||
if ((text.value.charCodeAt(0)|0) < 129) {
|
||||
return;
|
||||
}
|
||||
inCompostion ? onCompositionUpdate() : onCompositionStart();
|
||||
});
|
||||
}
|
||||
|
||||
event.addListener(text, "compositionstart", onCompositionStart);
|
||||
@@ -242,11 +309,10 @@ var TextInput = function(parentNode, host) {
|
||||
|
||||
event.addListener(text, "focus", function() {
|
||||
host.onFocus();
|
||||
reset();
|
||||
resetSelection();
|
||||
});
|
||||
|
||||
this.focus = function() {
|
||||
reset();
|
||||
text.focus();
|
||||
};
|
||||
|
||||
@@ -268,11 +334,11 @@ var TextInput = function(parentNode, host) {
|
||||
tempStyle = text.style.cssText;
|
||||
|
||||
text.style.cssText =
|
||||
"position:fixed; z-index:100000;" + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
|
||||
"position:fixed; z-index:100000;" +
|
||||
(useragent.isIE ? "background:rgba(0, 0, 0, 0.03); opacity:0.1;" : "") + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
|
||||
"left:" + (e.clientX - 2) + "px; top:" + (e.clientY - 2) + "px;";
|
||||
|
||||
if (host.selection.isEmpty())
|
||||
text.value = "";
|
||||
resetSelection(host.selection.isEmpty());
|
||||
|
||||
if (e.type != "mousedown")
|
||||
return;
|
||||
@@ -281,7 +347,7 @@ var TextInput = function(parentNode, host) {
|
||||
host.renderer.$keepTextAreaAtCursor = null;
|
||||
|
||||
// on windows context menu is opened after mouseup
|
||||
if (useragent.isGecko && useragent.isWin)
|
||||
if (useragent.isWin)
|
||||
event.capture(host.container, function(e) {
|
||||
text.style.left = e.clientX - 2 + "px";
|
||||
text.style.top = e.clientY - 2 + "px";
|
||||
@@ -294,7 +360,6 @@ var TextInput = function(parentNode, host) {
|
||||
text.style.cssText = tempStyle;
|
||||
tempStyle = '';
|
||||
}
|
||||
sendText();
|
||||
if (host.renderer.$keepTextAreaAtCursor == null) {
|
||||
host.renderer.$keepTextAreaAtCursor = true;
|
||||
host.renderer.$moveTextAreaToCursor();
|
||||
@@ -307,7 +372,7 @@ var TextInput = function(parentNode, host) {
|
||||
if (!useragent.isGecko)
|
||||
event.addListener(text, "contextmenu", function(e) {
|
||||
host.textInput.onContextMenu(e);
|
||||
onContextMenuClose()
|
||||
onContextMenuClose();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,48 +1,40 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sergi Mansilla <sergi AT c9 DOT io>
|
||||
* Harutyun Amirjanyan <harutyun AT c9 DOT io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var keyUtil = require("../lib/keys");
|
||||
var cmds = require("./vim/commands");
|
||||
var coreCommands = cmds.coreCommands;
|
||||
var util = require("./vim/maps/util");
|
||||
var useragent = require("../lib/useragent");
|
||||
|
||||
var startCommands = {
|
||||
"i": {
|
||||
@@ -62,10 +54,32 @@ var startCommands = {
|
||||
},
|
||||
"ctrl-b": {
|
||||
command: "gotopageup"
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
exports.handler = {
|
||||
// workaround for j not repeating with `defaults write -g ApplePressAndHoldEnabled -bool true`
|
||||
handleMacRepeat: function(data, hashId, key) {
|
||||
if (hashId == -1) {
|
||||
// record key
|
||||
data.inputChar = key;
|
||||
data.lastEvent = "input";
|
||||
} else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) {
|
||||
// check for repeated keypress
|
||||
if (data.lastEvent == "input") {
|
||||
data.lastEvent = "input1";
|
||||
} else if (data.lastEvent == "input1") {
|
||||
// simulate textinput
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// reset
|
||||
data.$lastHash = hashId;
|
||||
data.$lastKey = key;
|
||||
data.lastEvent = "keypress";
|
||||
}
|
||||
},
|
||||
|
||||
handleKeyboard: function(data, hashId, key, keyCode, e) {
|
||||
// ignore command keys (shift, ctrl etc.)
|
||||
if (hashId != 0 && (key == "" || key == "\x00"))
|
||||
@@ -73,26 +87,31 @@ exports.handler = {
|
||||
|
||||
if (hashId == 1)
|
||||
key = "ctrl-" + key;
|
||||
|
||||
if (data.state == "start") {
|
||||
|
||||
if ((key == "esc" && hashId == 0) || key == "ctrl-[") {
|
||||
return {command: coreCommands.stop};
|
||||
} else if (data.state == "start") {
|
||||
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
|
||||
hashId = -1;
|
||||
key = data.inputChar;
|
||||
}
|
||||
|
||||
if (hashId == -1 || hashId == 1) {
|
||||
if (cmds.inputBuffer.idle && startCommands[key])
|
||||
return startCommands[key];
|
||||
|
||||
return { command: {
|
||||
exec: function(editor) {cmds.inputBuffer.push(editor, key);}
|
||||
} };
|
||||
} // wait for input
|
||||
else if (key.length == 1 && (hashId == 0 || hashId == 4)) { //no modifier || shift
|
||||
return {
|
||||
command: {
|
||||
exec: function(editor) {cmds.inputBuffer.push(editor, key);}
|
||||
}
|
||||
};
|
||||
} // if no modifier || shift: wait for input.
|
||||
else if (key.length == 1 && (hashId == 0 || hashId == 4)) {
|
||||
return {command: "null", passEvent: true};
|
||||
} else if (key == "esc") {
|
||||
} else if (key == "esc" && hashId == 0) {
|
||||
return {command: coreCommands.stop};
|
||||
}
|
||||
} else {
|
||||
if (key == "esc" || key == "ctrl-[") {
|
||||
data.state = "start";
|
||||
return {command: coreCommands.stop};
|
||||
} else if (key == "ctrl-w") {
|
||||
if (key == "ctrl-w") {
|
||||
return {command: "removewordleft"};
|
||||
}
|
||||
}
|
||||
@@ -102,6 +121,7 @@ exports.handler = {
|
||||
editor.on("click", exports.onCursorMove);
|
||||
if (util.currentMode !== "insert")
|
||||
cmds.coreCommands.stop.exec(editor);
|
||||
editor.$vimModeHandler = this;
|
||||
},
|
||||
|
||||
detach: function(editor) {
|
||||
@@ -110,7 +130,14 @@ exports.handler = {
|
||||
util.currentMode = "normal";
|
||||
},
|
||||
|
||||
actions: cmds.actions
|
||||
actions: cmds.actions,
|
||||
getStatusText: function() {
|
||||
if (util.currentMode == "insert")
|
||||
return "INSERT";
|
||||
if (util.onVisualMode)
|
||||
return (util.onVisualLineMode ? "VISUAL LINE " : "VISUAL ") + cmds.inputBuffer.status;
|
||||
return cmds.inputBuffer.status;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
+66
-61
@@ -1,38 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sergi Mansilla <sergi AT c9 DOT io>
|
||||
* Harutyun Amirjanyan <harutyun AT c9 DOT io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -82,13 +74,13 @@ var actions = exports.actions = {
|
||||
fn: function(editor, range, count, param) {
|
||||
switch (param) {
|
||||
case "z":
|
||||
editor.alignCursor(null, 0.5);
|
||||
editor.renderer.alignCursor(null, 0.5);
|
||||
break;
|
||||
case "t":
|
||||
editor.alignCursor(null, 0);
|
||||
editor.renderer.alignCursor(null, 0);
|
||||
break;
|
||||
case "b":
|
||||
editor.alignCursor(null, 1);
|
||||
editor.renderer.alignCursor(null, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -304,6 +296,7 @@ var inputBuffer = exports.inputBuffer = {
|
||||
currentCmd: null,
|
||||
//currentMode: 0,
|
||||
currentCount: "",
|
||||
status: "",
|
||||
|
||||
// Types
|
||||
operator: null,
|
||||
@@ -311,73 +304,84 @@ var inputBuffer = exports.inputBuffer = {
|
||||
|
||||
lastInsertCommands: [],
|
||||
|
||||
push: function(editor, char, keyId) {
|
||||
push: function(editor, ch, keyId) {
|
||||
this.idle = false;
|
||||
var wObj = this.waitingForParam;
|
||||
if (wObj) {
|
||||
this.exec(editor, wObj, char);
|
||||
this.exec(editor, wObj, ch);
|
||||
}
|
||||
// If input is a number (that doesn't start with 0)
|
||||
else if (!(char === "0" && !this.currentCount.length) &&
|
||||
(char.match(/^\d+$/) && this.isAccepting(NUMBER))) {
|
||||
// Assuming that char is always of type String, and not Number
|
||||
this.currentCount += char;
|
||||
else if (!(ch === "0" && !this.currentCount.length) &&
|
||||
(ch.match(/^\d+$/) && this.isAccepting(NUMBER))) {
|
||||
// Assuming that ch is always of type String, and not Number
|
||||
this.currentCount += ch;
|
||||
this.currentCmd = NUMBER;
|
||||
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
|
||||
}
|
||||
else if (!this.operator && this.isAccepting(OPERATOR) && operators[char]) {
|
||||
else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) {
|
||||
this.operator = {
|
||||
char: char,
|
||||
ch: ch,
|
||||
count: this.getCount()
|
||||
};
|
||||
this.currentCmd = OPERATOR;
|
||||
this.accepting = [NUMBER, MOTION, ACTION];
|
||||
this.exec(editor, { operator: this.operator });
|
||||
}
|
||||
else if (motions[char] && this.isAccepting(MOTION)) {
|
||||
else if (motions[ch] && this.isAccepting(MOTION)) {
|
||||
this.currentCmd = MOTION;
|
||||
|
||||
var ctx = {
|
||||
operator: this.operator,
|
||||
motion: {
|
||||
char: char,
|
||||
ch: ch,
|
||||
count: this.getCount()
|
||||
}
|
||||
};
|
||||
|
||||
if (motions[char].param)
|
||||
if (motions[ch].param)
|
||||
this.waitForParam(ctx);
|
||||
else
|
||||
this.exec(editor, ctx);
|
||||
}
|
||||
else if (alias[char] && this.isAccepting(MOTION)) {
|
||||
alias[char].operator.count = this.getCount();
|
||||
this.exec(editor, alias[char]);
|
||||
else if (alias[ch] && this.isAccepting(MOTION)) {
|
||||
alias[ch].operator.count = this.getCount();
|
||||
this.exec(editor, alias[ch]);
|
||||
}
|
||||
else if (actions[char] && this.isAccepting(ACTION)) {
|
||||
else if (actions[ch] && this.isAccepting(ACTION)) {
|
||||
var actionObj = {
|
||||
action: {
|
||||
fn: actions[char].fn,
|
||||
fn: actions[ch].fn,
|
||||
count: this.getCount()
|
||||
}
|
||||
};
|
||||
|
||||
if (actions[char].param) {
|
||||
if (actions[ch].param) {
|
||||
this.waitForParam(actionObj);
|
||||
}
|
||||
else {
|
||||
this.exec(editor, actionObj);
|
||||
}
|
||||
|
||||
if (actions[char].acceptsMotion)
|
||||
if (actions[ch].acceptsMotion)
|
||||
this.idle = false;
|
||||
}
|
||||
else if (this.operator) {
|
||||
this.exec(editor, { operator: this.operator }, char);
|
||||
this.exec(editor, { operator: this.operator }, ch);
|
||||
}
|
||||
else {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
if (this.waitingForParam || this.motion || this.operator) {
|
||||
this.status += ch;
|
||||
} else if (this.currentCount) {
|
||||
this.status = this.currentCount;
|
||||
} else if (this.status) {
|
||||
this.status = "";
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
editor._emit("changeStatus");
|
||||
},
|
||||
|
||||
waitForParam: function(cmd) {
|
||||
@@ -406,18 +410,18 @@ var inputBuffer = exports.inputBuffer = {
|
||||
}
|
||||
|
||||
if (o && !editor.selection.isEmpty()) {
|
||||
if (operators[o.char].selFn) {
|
||||
operators[o.char].selFn(editor, editor.getSelectionRange(), o.count, param);
|
||||
if (operators[o.ch].selFn) {
|
||||
operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param);
|
||||
this.reset();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// There is an operator, but no motion or action. We try to pass the
|
||||
// current char to the operator to see if it responds to it (an example
|
||||
// current ch to the operator to see if it responds to it (an example
|
||||
// of this is the 'dd' operator).
|
||||
else if (!m && !a && o && param) {
|
||||
operators[o.char].fn(editor, null, o.count, param);
|
||||
operators[o.ch].fn(editor, null, o.count, param);
|
||||
this.reset();
|
||||
}
|
||||
else if (m) {
|
||||
@@ -430,7 +434,7 @@ var inputBuffer = exports.inputBuffer = {
|
||||
}
|
||||
};
|
||||
|
||||
var motionObj = motions[m.char];
|
||||
var motionObj = motions[m.ch];
|
||||
var selectable = motionObj.sel;
|
||||
|
||||
if (!o) {
|
||||
@@ -442,7 +446,7 @@ var inputBuffer = exports.inputBuffer = {
|
||||
else if (selectable) {
|
||||
repeat(function() {
|
||||
run(motionObj.sel);
|
||||
operators[o.char].fn(editor, editor.getSelectionRange(), o.count, param);
|
||||
operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param);
|
||||
}, o.count || 1);
|
||||
}
|
||||
this.reset();
|
||||
@@ -462,6 +466,7 @@ var inputBuffer = exports.inputBuffer = {
|
||||
this.operator = null;
|
||||
this.motion = null;
|
||||
this.currentCount = "";
|
||||
this.status = "";
|
||||
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
|
||||
this.idle = true;
|
||||
this.waitingForParam = null;
|
||||
|
||||
+36
-43
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sergi Mansilla <sergi AT c9 DOT io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -41,57 +34,57 @@ define(function(require, exports, module) {
|
||||
module.exports = {
|
||||
"x": {
|
||||
operator: {
|
||||
char: "d",
|
||||
ch: "d",
|
||||
count: 1
|
||||
},
|
||||
motion: {
|
||||
char: "l",
|
||||
ch: "l",
|
||||
count: 1
|
||||
}
|
||||
},
|
||||
"X": {
|
||||
operator: {
|
||||
char: "d",
|
||||
ch: "d",
|
||||
count: 1
|
||||
},
|
||||
motion: {
|
||||
char: "h",
|
||||
ch: "h",
|
||||
count: 1
|
||||
}
|
||||
},
|
||||
"D": {
|
||||
operator: {
|
||||
char: "d",
|
||||
ch: "d",
|
||||
count: 1
|
||||
},
|
||||
motion: {
|
||||
char: "$",
|
||||
ch: "$",
|
||||
count: 1
|
||||
}
|
||||
},
|
||||
"C": {
|
||||
operator: {
|
||||
char: "c",
|
||||
ch: "c",
|
||||
count: 1
|
||||
},
|
||||
motion: {
|
||||
char: "$",
|
||||
ch: "$",
|
||||
count: 1
|
||||
}
|
||||
},
|
||||
"s": {
|
||||
operator: {
|
||||
char: "c",
|
||||
ch: "c",
|
||||
count: 1
|
||||
},
|
||||
motion: {
|
||||
char: "l",
|
||||
ch: "l",
|
||||
count: 1
|
||||
}
|
||||
},
|
||||
"S": {
|
||||
operator: {
|
||||
char: "c",
|
||||
ch: "c",
|
||||
count: 1
|
||||
},
|
||||
param: "c"
|
||||
|
||||
+138
-156
@@ -1,44 +1,36 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sergi Mansilla <sergi AT c9 DOT io>
|
||||
* Harutyun Amirjanyan <harutyun AT c9 DOT io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
"use strict"
|
||||
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var util = require("./util");
|
||||
|
||||
@@ -50,42 +42,27 @@ var keepScrollPosition = function(editor, fn) {
|
||||
editor.renderer.scrollToRow(editor.getCursorPosition().row - diff);
|
||||
};
|
||||
|
||||
function Motion(getRange, type){
|
||||
if (type == 'extend')
|
||||
var extend = true;
|
||||
else
|
||||
var reverse = type;
|
||||
|
||||
this.nav = function(editor) {
|
||||
var r = getRange(editor);
|
||||
if (!r)
|
||||
function Motion(m) {
|
||||
if (typeof m == "function") {
|
||||
var getPos = m;
|
||||
m = this;
|
||||
} else {
|
||||
var getPos = m.getPos;
|
||||
}
|
||||
m.nav = function(editor, range, count, param) {
|
||||
var a = getPos(editor, range, count, param, false);
|
||||
if (!a)
|
||||
return;
|
||||
if (!r.end)
|
||||
var a = r;
|
||||
else if (reverse)
|
||||
var a = r.start;
|
||||
else
|
||||
var a = r.end;
|
||||
|
||||
editor.clearSelection();
|
||||
editor.moveCursorTo(a.row, a.column);
|
||||
}
|
||||
this.sel = function(editor){
|
||||
var r = getRange(editor);
|
||||
if (!r)
|
||||
};
|
||||
m.sel = function(editor, range, count, param) {
|
||||
var a = getPos(editor, range, count, param, true);
|
||||
if (!a)
|
||||
return;
|
||||
if (extend)
|
||||
return editor.selection.setSelectionRange(r);
|
||||
|
||||
if (!r.end)
|
||||
var a = r;
|
||||
else if (reverse)
|
||||
var a = r.start;
|
||||
else
|
||||
var a = r.end;
|
||||
|
||||
editor.selection.selectTo(a.row, a.column);
|
||||
}
|
||||
};
|
||||
return m;
|
||||
}
|
||||
|
||||
var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
|
||||
@@ -98,20 +75,20 @@ var StringStream = function(editor, cursor) {
|
||||
this.row = cursor.row;
|
||||
this.col = cursor.column;
|
||||
var line = editor.session.getLine(this.row);
|
||||
var maxRow = editor.session.getLength()
|
||||
this.ch = line[this.col] || '\n'
|
||||
var maxRow = editor.session.getLength();
|
||||
this.ch = line[this.col] || '\n';
|
||||
this.skippedLines = 0;
|
||||
|
||||
this.next = function() {
|
||||
this.ch = line[++this.col] || this.handleNewLine(1);
|
||||
//this.debug()
|
||||
return this.ch;
|
||||
}
|
||||
};
|
||||
this.prev = function() {
|
||||
this.ch = line[--this.col] || this.handleNewLine(-1);
|
||||
//this.debug()
|
||||
return this.ch;
|
||||
}
|
||||
};
|
||||
this.peek = function(dir) {
|
||||
var ch = line[this.col + dir];
|
||||
if (ch)
|
||||
@@ -121,7 +98,7 @@ var StringStream = function(editor, cursor) {
|
||||
if (this.col == line.length - 1)
|
||||
return '\n';
|
||||
return editor.session.getLine(this.row + 1)[0] || '\n';
|
||||
}
|
||||
};
|
||||
|
||||
this.handleNewLine = function(dir) {
|
||||
if (dir == 1){
|
||||
@@ -136,7 +113,7 @@ var StringStream = function(editor, cursor) {
|
||||
return line[0] || '\n';
|
||||
}
|
||||
if (dir == -1) {
|
||||
if (this.row == 0)
|
||||
if (this.row === 0)
|
||||
return '';
|
||||
this.row --;
|
||||
line = editor.session.getLine(this.row);
|
||||
@@ -144,13 +121,13 @@ var StringStream = function(editor, cursor) {
|
||||
this.skippedLines--;
|
||||
return '\n';
|
||||
}
|
||||
}
|
||||
};
|
||||
this.debug = function() {
|
||||
console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1));
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var Search = require("ace/search").Search;
|
||||
var Search = require("../../../search").Search;
|
||||
var search = new Search();
|
||||
|
||||
function find(editor, needle, dir) {
|
||||
@@ -159,7 +136,7 @@ function find(editor, needle, dir) {
|
||||
return search.find(editor.session);
|
||||
}
|
||||
|
||||
var Range = require("ace/range").Range;
|
||||
var Range = require("../../../range").Range;
|
||||
|
||||
module.exports = {
|
||||
"w": new Motion(function(editor) {
|
||||
@@ -187,7 +164,7 @@ module.exports = {
|
||||
else
|
||||
str.next();
|
||||
|
||||
return {column: str.col, row: str.row}
|
||||
return {column: str.col, row: str.row};
|
||||
}),
|
||||
"b": new Motion(function(editor) {
|
||||
var str = new StringStream(editor);
|
||||
@@ -207,7 +184,7 @@ module.exports = {
|
||||
return {column: str.col, row: str.row};
|
||||
}),
|
||||
"B": new Motion(function(editor) {
|
||||
var str = new StringStream(editor)
|
||||
var str = new StringStream(editor);
|
||||
str.prev();
|
||||
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
|
||||
str.prev();
|
||||
@@ -216,7 +193,7 @@ module.exports = {
|
||||
str.next();
|
||||
|
||||
return {column: str.col, row: str.row};
|
||||
}, true),
|
||||
}),
|
||||
"e": new Motion(function(editor) {
|
||||
var str = new StringStream(editor);
|
||||
|
||||
@@ -270,6 +247,40 @@ module.exports = {
|
||||
editor.selection.selectLeft();
|
||||
}
|
||||
},
|
||||
"H": {
|
||||
nav: function(editor) {
|
||||
var row = editor.renderer.getScrollTopRow();
|
||||
editor.moveCursorTo(row);
|
||||
},
|
||||
sel: function(editor) {
|
||||
var row = editor.renderer.getScrollTopRow();
|
||||
editor.selection.selectTo(row);
|
||||
}
|
||||
},
|
||||
"M": {
|
||||
nav: function(editor) {
|
||||
var topRow = editor.renderer.getScrollTopRow();
|
||||
var bottomRow = editor.renderer.getScrollBottomRow();
|
||||
var row = topRow + ((bottomRow - topRow) / 2);
|
||||
editor.moveCursorTo(row);
|
||||
},
|
||||
sel: function(editor) {
|
||||
var topRow = editor.renderer.getScrollTopRow();
|
||||
var bottomRow = editor.renderer.getScrollBottomRow();
|
||||
var row = topRow + ((bottomRow - topRow) / 2);
|
||||
editor.selection.selectTo(row);
|
||||
}
|
||||
},
|
||||
"L": {
|
||||
nav: function(editor) {
|
||||
var row = editor.renderer.getScrollBottomRow();
|
||||
editor.moveCursorTo(row);
|
||||
},
|
||||
sel: function(editor) {
|
||||
var row = editor.renderer.getScrollBottomRow();
|
||||
editor.selection.selectTo(row);
|
||||
}
|
||||
},
|
||||
"k": {
|
||||
nav: function(editor) {
|
||||
editor.navigateUp();
|
||||
@@ -363,99 +374,58 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
"f": {
|
||||
"f": new Motion({
|
||||
param: true,
|
||||
handlesCount: true,
|
||||
nav: function(editor, range, count, param) {
|
||||
var ed = editor;
|
||||
var cursor = ed.getCursorPosition();
|
||||
getPos: function(editor, range, count, param, isSel) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var column = util.getRightNthChar(editor, cursor, param, count || 1);
|
||||
|
||||
if (typeof column === "number") {
|
||||
ed.selection.clearSelection(); // Why does it select in the first place?
|
||||
ed.moveCursorTo(cursor.row, column + cursor.column + 1);
|
||||
}
|
||||
},
|
||||
sel: function(editor, range, count, param) {
|
||||
var ed = editor;
|
||||
var cursor = ed.getCursorPosition();
|
||||
var column = util.getRightNthChar(editor, cursor, param, count || 1);
|
||||
|
||||
if (typeof column === "number") {
|
||||
ed.moveCursorTo(cursor.row, column + cursor.column + 1);
|
||||
cursor.column += column + (isSel ? 2 : 1);
|
||||
return cursor;
|
||||
}
|
||||
}
|
||||
},
|
||||
"F": {
|
||||
}),
|
||||
"F": new Motion({
|
||||
param: true,
|
||||
handlesCount: true,
|
||||
nav: function(editor, range, count, param) {
|
||||
count = parseInt(count, 10) || 1;
|
||||
var ed = editor;
|
||||
var cursor = ed.getCursorPosition();
|
||||
var column = util.getLeftNthChar(editor, cursor, param, count);
|
||||
|
||||
if (typeof column === "number") {
|
||||
ed.selection.clearSelection(); // Why does it select in the first place?
|
||||
ed.moveCursorTo(cursor.row, cursor.column - column - 1);
|
||||
}
|
||||
},
|
||||
sel: function(editor, range, count, param) {
|
||||
var ed = editor;
|
||||
var cursor = ed.getCursorPosition();
|
||||
getPos: function(editor, range, count, param, isSel) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
|
||||
|
||||
if (typeof column === "number") {
|
||||
ed.moveCursorTo(cursor.row, cursor.column - column - 1);
|
||||
cursor.column -= column + 1;
|
||||
return cursor;
|
||||
}
|
||||
}
|
||||
},
|
||||
"t": {
|
||||
}),
|
||||
"t": new Motion({
|
||||
param: true,
|
||||
handlesCount: true,
|
||||
nav: function(editor, range, count, param) {
|
||||
var ed = editor;
|
||||
var cursor = ed.getCursorPosition();
|
||||
getPos: function(editor, range, count, param, isSel) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var column = util.getRightNthChar(editor, cursor, param, count || 1);
|
||||
|
||||
if (typeof column === "number") {
|
||||
ed.selection.clearSelection(); // Why does it select in the first place?
|
||||
ed.moveCursorTo(cursor.row, column + cursor.column);
|
||||
}
|
||||
},
|
||||
sel: function(editor, range, count, param) {
|
||||
var ed = editor;
|
||||
var cursor = ed.getCursorPosition();
|
||||
var column = util.getRightNthChar(editor, cursor, param, count || 1);
|
||||
|
||||
if (typeof column === "number") {
|
||||
ed.moveCursorTo(cursor.row, column + cursor.column);
|
||||
cursor.column += column + (isSel ? 1 : 0);
|
||||
return cursor;
|
||||
}
|
||||
}
|
||||
},
|
||||
"T": {
|
||||
}),
|
||||
"T": new Motion({
|
||||
param: true,
|
||||
handlesCount: true,
|
||||
nav: function(editor, range, count, param) {
|
||||
var ed = editor;
|
||||
var cursor = ed.getCursorPosition();
|
||||
getPos: function(editor, range, count, param, isSel) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
|
||||
|
||||
if (typeof column === "number") {
|
||||
ed.selection.clearSelection(); // Why does it select in the first place?
|
||||
ed.moveCursorTo(cursor.row, -column + cursor.column);
|
||||
}
|
||||
},
|
||||
sel: function(editor, range, count, param) {
|
||||
var ed = editor;
|
||||
var cursor = ed.getCursorPosition();
|
||||
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
|
||||
|
||||
if (typeof column === "number") {
|
||||
ed.moveCursorTo(cursor.row, -column + cursor.column);
|
||||
cursor.column -= column;
|
||||
return cursor;
|
||||
}
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
||||
"^": {
|
||||
nav: function(editor) {
|
||||
@@ -473,16 +443,9 @@ module.exports = {
|
||||
editor.selection.selectLineEnd();
|
||||
}
|
||||
},
|
||||
"0": {
|
||||
nav: function(editor) {
|
||||
var ed = editor;
|
||||
ed.navigateTo(ed.selection.selectionLead.row, 0);
|
||||
},
|
||||
sel: function(editor) {
|
||||
var ed = editor;
|
||||
ed.selectTo(ed.selection.selectionLead.row, 0);
|
||||
}
|
||||
},
|
||||
"0": new Motion(function(ed) {
|
||||
return {row: ed.selection.lead.row, column: 0};
|
||||
}),
|
||||
"G": {
|
||||
nav: function(editor, range, count, param) {
|
||||
if (!count && count !== 0) { // Stupid JS
|
||||
@@ -580,6 +543,25 @@ module.exports = {
|
||||
|
||||
return match;
|
||||
}),
|
||||
"{": new Motion(function(ed) {
|
||||
var session = ed.session;
|
||||
var row = session.selection.lead.row;
|
||||
while(row > 0 && !/\S/.test(session.getLine(row)))
|
||||
row--;
|
||||
while(/\S/.test(session.getLine(row)))
|
||||
row--;
|
||||
return {column: 0, row: row};
|
||||
}),
|
||||
"}": new Motion(function(ed) {
|
||||
var session = ed.session;
|
||||
var l = session.getLength();
|
||||
var row = session.selection.lead.row;
|
||||
while(row < l && !/\S/.test(session.getLine(row)))
|
||||
row++;
|
||||
while(/\S/.test(session.getLine(row)))
|
||||
row++;
|
||||
return {column: 0, row: row};
|
||||
}),
|
||||
"ctrl-d": {
|
||||
nav: function(editor, range, count, param) {
|
||||
editor.selection.clearSelection();
|
||||
@@ -598,7 +580,7 @@ module.exports = {
|
||||
sel: function(editor, range, count, param) {
|
||||
keepScrollPosition(editor, editor.selectPageUp);
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.backspace = module.exports.left = module.exports.h;
|
||||
|
||||
+35
-32
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sergi Mansilla <sergi AT c9 DOT io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -63,6 +56,16 @@ module.exports = {
|
||||
editor.selection.selectLine();
|
||||
registers._default.text += editor.getCopyText();
|
||||
var selRange = editor.getSelectionRange();
|
||||
// check if end of the document was reached
|
||||
if (!selRange.isMultiLine()) {
|
||||
lastLineReached = true
|
||||
var row = selRange.start.row - 1;
|
||||
var col = editor.session.getLine(row).length
|
||||
selRange.setStart(row, col);
|
||||
editor.session.remove(selRange);
|
||||
editor.selection.clearSelection();
|
||||
break;
|
||||
}
|
||||
editor.session.remove(selRange);
|
||||
editor.selection.clearSelection();
|
||||
}
|
||||
|
||||
+18
-18
@@ -2,7 +2,7 @@ define(function(require, exports, module) {
|
||||
var registers = require("../registers");
|
||||
|
||||
var dom = require("../../../lib/dom");
|
||||
dom.importCssString('.insert-mode. ace_cursor{\
|
||||
dom.importCssString('.insert-mode .ace_cursor{\
|
||||
border-left: 2px solid #333333;\
|
||||
}\
|
||||
.ace_dark.insert-mode .ace_cursor{\
|
||||
@@ -22,7 +22,7 @@ module.exports = {
|
||||
editor.unsetStyle('insert-mode');
|
||||
editor.unsetStyle('normal-mode');
|
||||
if (editor.commands.recording)
|
||||
editor.commands.toggleRecording();
|
||||
editor.commands.toggleRecording(editor);
|
||||
editor.setOverwrite(false);
|
||||
},
|
||||
insertMode: function(editor) {
|
||||
@@ -43,10 +43,10 @@ module.exports = {
|
||||
this.onInsertReplaySequence = null;
|
||||
this.normalMode(editor);
|
||||
} else {
|
||||
editor._emit("vimMode", "insert");
|
||||
editor._emit("changeStatus");
|
||||
// Record any movements, insertions in insert mode
|
||||
if(!editor.commands.recording)
|
||||
editor.commands.toggleRecording();
|
||||
editor.commands.toggleRecording(editor);
|
||||
}
|
||||
},
|
||||
normalMode: function(editor) {
|
||||
@@ -69,10 +69,10 @@ module.exports = {
|
||||
editor.keyBinding.$data.state = "start";
|
||||
this.onVisualMode = false;
|
||||
this.onVisualLineMode = false;
|
||||
editor._emit("changeVimMode", "normal");
|
||||
editor._emit("changeStatus");
|
||||
// Save recorded keystrokes
|
||||
if (editor.commands.recording) {
|
||||
editor.commands.toggleRecording();
|
||||
editor.commands.toggleRecording(editor);
|
||||
return editor.commands.macro;
|
||||
}
|
||||
else {
|
||||
@@ -91,7 +91,7 @@ module.exports = {
|
||||
editor.setStyle('insert-mode');
|
||||
editor.unsetStyle('normal-mode');
|
||||
|
||||
editor._emit("changeVimMode", "visual");
|
||||
editor._emit("changeStatus");
|
||||
if (lineMode) {
|
||||
this.onVisualLineMode = true;
|
||||
} else {
|
||||
@@ -99,24 +99,24 @@ module.exports = {
|
||||
this.onVisualLineMode = false;
|
||||
}
|
||||
},
|
||||
getRightNthChar: function(editor, cursor, char, n) {
|
||||
getRightNthChar: function(editor, cursor, ch, n) {
|
||||
var line = editor.getSession().getLine(cursor.row);
|
||||
var matches = line.substr(cursor.column + 1).split(char);
|
||||
var matches = line.substr(cursor.column + 1).split(ch);
|
||||
|
||||
return n < matches.length ? matches.slice(0, n).join(char).length : null;
|
||||
return n < matches.length ? matches.slice(0, n).join(ch).length : null;
|
||||
},
|
||||
getLeftNthChar: function(editor, cursor, char, n) {
|
||||
getLeftNthChar: function(editor, cursor, ch, n) {
|
||||
var line = editor.getSession().getLine(cursor.row);
|
||||
var matches = line.substr(0, cursor.column).split(char);
|
||||
var matches = line.substr(0, cursor.column).split(ch);
|
||||
|
||||
return n < matches.length ? matches.slice(-1 * n).join(char).length : null;
|
||||
return n < matches.length ? matches.slice(-1 * n).join(ch).length : null;
|
||||
},
|
||||
toRealChar: function(char) {
|
||||
if (char.length === 1)
|
||||
return char;
|
||||
toRealChar: function(ch) {
|
||||
if (ch.length === 1)
|
||||
return ch;
|
||||
|
||||
if (/^shift-./.test(char))
|
||||
return char[char.length - 1].toUpperCase();
|
||||
if (/^shift-./.test(ch))
|
||||
return ch[ch.length - 1].toUpperCase();
|
||||
else
|
||||
return "";
|
||||
},
|
||||
|
||||
+25
-32
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sergi Mansilla <sergi AT c9 DOT io>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
@@ -1,39 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -48,9 +39,13 @@ var Cursor = function(parentEl) {
|
||||
parentEl.appendChild(this.element);
|
||||
|
||||
this.isVisible = false;
|
||||
this.isBlinking = true;
|
||||
this.blinkInterval = 1000;
|
||||
this.smoothBlinking = false;
|
||||
|
||||
this.cursors = [];
|
||||
this.cursor = this.addCursor();
|
||||
dom.addCssClass(this.element, "ace_hidden-cursors");
|
||||
};
|
||||
|
||||
(function() {
|
||||
@@ -64,15 +59,34 @@ var Cursor = function(parentEl) {
|
||||
this.session = session;
|
||||
};
|
||||
|
||||
this.setBlinking = function(blinking) {
|
||||
if (blinking != this.isBlinking){
|
||||
this.isBlinking = blinking;
|
||||
this.restartTimer();
|
||||
}
|
||||
};
|
||||
|
||||
this.setBlinkInterval = function(blinkInterval) {
|
||||
if (blinkInterval != this.blinkInterval){
|
||||
this.blinkInterval = blinkInterval;
|
||||
this.restartTimer();
|
||||
}
|
||||
};
|
||||
|
||||
this.setSmoothBlinking = function(smoothBlinking) {
|
||||
if (smoothBlinking != this.smoothBlinking) {
|
||||
this.smoothBlinking = smoothBlinking;
|
||||
if (smoothBlinking)
|
||||
dom.addCssClass(this.element, "ace_smooth-blinking");
|
||||
else
|
||||
dom.removeCssClass(this.element, "ace_smooth-blinking");
|
||||
this.restartTimer();
|
||||
}
|
||||
};
|
||||
|
||||
this.addCursor = function() {
|
||||
var el = dom.createElement("div");
|
||||
var className = "ace_cursor";
|
||||
if (!this.isVisible)
|
||||
className += " ace_hidden";
|
||||
if (this.overwrite)
|
||||
className += " ace_overwrite";
|
||||
|
||||
el.className = className;
|
||||
el.className = "ace_cursor";
|
||||
this.element.appendChild(el);
|
||||
this.cursors.push(el);
|
||||
return el;
|
||||
@@ -88,112 +102,113 @@ var Cursor = function(parentEl) {
|
||||
|
||||
this.hideCursor = function() {
|
||||
this.isVisible = false;
|
||||
for (var i = this.cursors.length; i--; )
|
||||
dom.addCssClass(this.cursors[i], "ace_hidden");
|
||||
clearInterval(this.blinkId);
|
||||
dom.addCssClass(this.element, "ace_hidden-cursors");
|
||||
this.restartTimer();
|
||||
};
|
||||
|
||||
this.showCursor = function() {
|
||||
this.isVisible = true;
|
||||
for (var i = this.cursors.length; i--; )
|
||||
dom.removeCssClass(this.cursors[i], "ace_hidden");
|
||||
|
||||
this.element.style.visibility = "";
|
||||
dom.removeCssClass(this.element, "ace_hidden-cursors");
|
||||
this.restartTimer();
|
||||
};
|
||||
|
||||
this.restartTimer = function() {
|
||||
clearInterval(this.blinkId);
|
||||
if (!this.isVisible)
|
||||
clearInterval(this.intervalId);
|
||||
clearTimeout(this.timeoutId);
|
||||
if (this.smoothBlinking)
|
||||
dom.removeCssClass(this.element, "ace_smooth-blinking");
|
||||
for (var i = this.cursors.length; i--; )
|
||||
this.cursors[i].style.opacity = "";
|
||||
|
||||
if (!this.isBlinking || !this.blinkInterval || !this.isVisible)
|
||||
return;
|
||||
|
||||
var element = this.cursors.length == 1 ? this.cursor : this.element;
|
||||
this.blinkId = setInterval(function() {
|
||||
element.style.visibility = "hidden";
|
||||
setTimeout(function() {
|
||||
element.style.visibility = "";
|
||||
}, 400);
|
||||
}, 1000);
|
||||
if (this.smoothBlinking)
|
||||
setTimeout(function(){
|
||||
dom.addCssClass(this.element, "ace_smooth-blinking");
|
||||
}.bind(this));
|
||||
|
||||
var blink = function(){
|
||||
this.timeoutId = setTimeout(function() {
|
||||
for (var i = this.cursors.length; i--; ) {
|
||||
this.cursors[i].style.opacity = 0;
|
||||
}
|
||||
}.bind(this), 0.6 * this.blinkInterval);
|
||||
}.bind(this);
|
||||
|
||||
this.intervalId = setInterval(function() {
|
||||
for (var i = this.cursors.length; i--; ) {
|
||||
this.cursors[i].style.opacity = "";
|
||||
}
|
||||
blink();
|
||||
}.bind(this), this.blinkInterval);
|
||||
|
||||
blink();
|
||||
};
|
||||
|
||||
this.getPixelPosition = function(position, onScreen) {
|
||||
if (!this.config || !this.session) {
|
||||
return {
|
||||
left : 0,
|
||||
top : 0
|
||||
};
|
||||
}
|
||||
if (!this.config || !this.session)
|
||||
return {left : 0, top : 0};
|
||||
|
||||
if (!position)
|
||||
position = this.session.selection.getCursor();
|
||||
var pos = this.session.documentToScreenPosition(position);
|
||||
var cursorLeft = Math.round(this.$padding +
|
||||
pos.column * this.config.characterWidth);
|
||||
var cursorLeft = this.$padding + pos.column * this.config.characterWidth;
|
||||
var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
|
||||
this.config.lineHeight;
|
||||
|
||||
return {
|
||||
left : cursorLeft,
|
||||
top : cursorTop
|
||||
};
|
||||
return {left : cursorLeft, top : cursorTop};
|
||||
};
|
||||
|
||||
this.update = function(config) {
|
||||
this.config = config;
|
||||
|
||||
if (this.session.selectionMarkerCount > 0) {
|
||||
var selections = this.session.$selectionMarkers;
|
||||
var i = 0, sel, cursorIndex = 0;
|
||||
var selections = this.session.$selectionMarkers;
|
||||
var i = 0, cursorIndex = 0;
|
||||
|
||||
for (var i = selections.length; i--; ) {
|
||||
sel = selections[i];
|
||||
var pixelPos = this.getPixelPosition(sel.cursor, true);
|
||||
if (selections === undefined || selections.length === 0){
|
||||
selections = [{cursor: null}];
|
||||
}
|
||||
|
||||
var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
|
||||
|
||||
style.left = pixelPos.left + "px";
|
||||
style.top = pixelPos.top + "px";
|
||||
style.width = config.characterWidth + "px";
|
||||
style.height = config.lineHeight + "px";
|
||||
for (var i = selections.length; i--; ) {
|
||||
var pixelPos = this.getPixelPosition(selections[i].cursor, true);
|
||||
if ((pixelPos.top > config.height + config.offset ||
|
||||
pixelPos.top < -config.offset) && i > 1) {
|
||||
continue;
|
||||
}
|
||||
if (cursorIndex > 1)
|
||||
while (this.cursors.length > cursorIndex)
|
||||
this.removeCursor();
|
||||
} else {
|
||||
var pixelPos = this.getPixelPosition(null, true);
|
||||
var style = this.cursor.style;
|
||||
|
||||
var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
|
||||
|
||||
style.left = pixelPos.left + "px";
|
||||
style.top = pixelPos.top + "px";
|
||||
style.width = config.characterWidth + "px";
|
||||
style.height = config.lineHeight + "px";
|
||||
|
||||
while (this.cursors.length > 1)
|
||||
this.removeCursor();
|
||||
}
|
||||
while (this.cursors.length > cursorIndex)
|
||||
this.removeCursor();
|
||||
|
||||
var overwrite = this.session.getOverwrite();
|
||||
if (overwrite != this.overwrite)
|
||||
this.$setOverite(overwrite);
|
||||
this.$setOverwrite(overwrite);
|
||||
|
||||
// cache for textarea and gutter highlight
|
||||
this.$pixelPos = pixelPos;
|
||||
|
||||
this.restartTimer();
|
||||
};
|
||||
|
||||
this.$setOverite = function(overwrite) {
|
||||
this.overwrite = overwrite;
|
||||
for (var i = this.cursors.length; i--; ) {
|
||||
this.$setOverwrite = function(overwrite) {
|
||||
if (overwrite != this.overwrite) {
|
||||
this.overwrite = overwrite;
|
||||
if (overwrite)
|
||||
dom.addCssClass(this.cursors[i], "ace_overwrite");
|
||||
dom.addCssClass(this.element, "ace_overwrite-cursors");
|
||||
else
|
||||
dom.removeCssClass(this.cursors[i], "ace_overwrite");
|
||||
dom.removeCssClass(this.element, "ace_overwrite-cursors");
|
||||
}
|
||||
};
|
||||
|
||||
this.destroy = function() {
|
||||
clearInterval(this.blinkId);
|
||||
}
|
||||
clearInterval(this.intervalId);
|
||||
clearTimeout(this.timeoutId);
|
||||
};
|
||||
|
||||
}).call(Cursor.prototype);
|
||||
|
||||
|
||||
@@ -1,39 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian DOT viereck AT gmail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -42,6 +33,7 @@ define(function(require, exports, module) {
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||
|
||||
var Gutter = function(parentEl) {
|
||||
@@ -52,60 +44,80 @@ var Gutter = function(parentEl) {
|
||||
|
||||
this.gutterWidth = 0;
|
||||
|
||||
this.$breakpoints = [];
|
||||
this.$annotations = [];
|
||||
this.$decorations = [];
|
||||
this.$updateAnnotations = this.$updateAnnotations.bind(this);
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
|
||||
this.setSession = function(session) {
|
||||
if (this.session)
|
||||
this.session.removeEventListener("change", this.$updateAnnotations);
|
||||
this.session = session;
|
||||
session.on("change", this.$updateAnnotations);
|
||||
};
|
||||
|
||||
this.addGutterDecoration = function(row, className){
|
||||
if (!this.$decorations[row])
|
||||
this.$decorations[row] = "";
|
||||
this.$decorations[row] += " " + className;
|
||||
if (window.console)
|
||||
console.warn && console.warn("deprecated use session.addGutterDecoration");
|
||||
this.session.addGutterDecoration(row, className);
|
||||
};
|
||||
|
||||
this.removeGutterDecoration = function(row, className){
|
||||
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
|
||||
if (window.console)
|
||||
console.warn && console.warn("deprecated use session.removeGutterDecoration");
|
||||
this.session.removeGutterDecoration(row, className);
|
||||
};
|
||||
|
||||
this.setAnnotations = function(annotations) {
|
||||
// iterate over sparse array
|
||||
this.$annotations = [];
|
||||
for (var row in annotations) if (annotations.hasOwnProperty(row)) {
|
||||
var rowAnnotations = annotations[row];
|
||||
if (!rowAnnotations)
|
||||
continue;
|
||||
this.$annotations = []
|
||||
var rowInfo, row;
|
||||
for (var i = 0; i < annotations.length; i++) {
|
||||
var annotation = annotations[i];
|
||||
var row = annotation.row;
|
||||
var rowInfo = this.$annotations[row];
|
||||
if (!rowInfo)
|
||||
rowInfo = this.$annotations[row] = {text: []};
|
||||
|
||||
var annoText = annotation.text;
|
||||
annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || "";
|
||||
|
||||
var rowInfo = this.$annotations[row] = {
|
||||
text: []
|
||||
};
|
||||
for (var i=0; i<rowAnnotations.length; i++) {
|
||||
var annotation = rowAnnotations[i];
|
||||
var annoText = annotation.text.replace(/"/g, """).replace(/'/g, "’").replace(/</, "<");
|
||||
if (rowInfo.text.indexOf(annoText) === -1)
|
||||
rowInfo.text.push(annoText);
|
||||
var type = annotation.type;
|
||||
if (type == "error")
|
||||
rowInfo.className = "ace_error";
|
||||
else if (type == "warning" && rowInfo.className != "ace_error")
|
||||
rowInfo.className = "ace_warning";
|
||||
else if (type == "info" && (!rowInfo.className))
|
||||
rowInfo.className = "ace_info";
|
||||
}
|
||||
if (rowInfo.text.indexOf(annoText) === -1)
|
||||
rowInfo.text.push(annoText);
|
||||
|
||||
var type = annotation.type;
|
||||
if (type == "error")
|
||||
rowInfo.className = " ace_error";
|
||||
else if (type == "warning" && rowInfo.className != " ace_error")
|
||||
rowInfo.className = " ace_warning";
|
||||
else if (type == "info" && (!rowInfo.className))
|
||||
rowInfo.className = " ace_info";
|
||||
}
|
||||
};
|
||||
|
||||
this.$updateAnnotations = function (e) {
|
||||
if (!this.$annotations.length)
|
||||
return;
|
||||
var delta = e.data;
|
||||
var range = delta.range;
|
||||
var firstRow = range.start.row;
|
||||
var len = range.end.row - firstRow;
|
||||
if (len === 0) {
|
||||
// do nothing
|
||||
} else if (delta.action == "removeText" || delta.action == "removeLines") {
|
||||
this.$annotations.splice(firstRow, len + 1, null);
|
||||
} else {
|
||||
var args = Array(len + 1);
|
||||
args.unshift(firstRow, 1);
|
||||
this.$annotations.splice.apply(this.$annotations, args);
|
||||
}
|
||||
};
|
||||
|
||||
this.update = function(config) {
|
||||
this.$config = config;
|
||||
|
||||
var emptyAnno = {className: "", text: []};
|
||||
var emptyAnno = {className: ""};
|
||||
var html = [];
|
||||
var i = config.firstRow;
|
||||
var lastRow = config.lastRow;
|
||||
@@ -113,6 +125,8 @@ var Gutter = function(parentEl) {
|
||||
var foldStart = fold ? fold.start.row : Infinity;
|
||||
var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets;
|
||||
var breakpoints = this.session.$breakpoints;
|
||||
var decorations = this.session.$decorations;
|
||||
var lastLineNumber = 0;
|
||||
|
||||
while (true) {
|
||||
if(i > foldStart) {
|
||||
@@ -124,12 +138,12 @@ var Gutter = function(parentEl) {
|
||||
break;
|
||||
|
||||
var annotation = this.$annotations[i] || emptyAnno;
|
||||
html.push("<div class='ace_gutter-cell",
|
||||
this.$decorations[i] || "",
|
||||
breakpoints[i] ? " ace_breakpoint " : " ",
|
||||
annotation.className,
|
||||
"' title='", annotation.text.join("\n"),
|
||||
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", (i+1));
|
||||
html.push(
|
||||
"<div class='ace_gutter-cell ",
|
||||
breakpoints[i] || "", decorations[i] || "", annotation.className,
|
||||
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>",
|
||||
lastLineNumber = i + 1
|
||||
);
|
||||
|
||||
if (foldWidgets) {
|
||||
var c = foldWidgets[i];
|
||||
@@ -138,8 +152,9 @@ var Gutter = function(parentEl) {
|
||||
c = foldWidgets[i] = this.session.getFoldWidget(i);
|
||||
if (c)
|
||||
html.push(
|
||||
"<span class='ace_fold-widget ", c,
|
||||
c == "start" && i == foldStart && i < fold.end.row ? " closed" : " open",
|
||||
"<span class='ace_fold-widget ace_", c,
|
||||
c == "start" && i == foldStart && i < fold.end.row ? " ace_closed" : " ace_open",
|
||||
"' style='height:", config.lineHeight, "px",
|
||||
"'></span>"
|
||||
);
|
||||
}
|
||||
@@ -149,19 +164,18 @@ var Gutter = function(parentEl) {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (this.session.$useWrapMode)
|
||||
html.push(
|
||||
"<div class='ace_gutter-cell' style='pointer-events:none;opacity:0'>",
|
||||
this.session.getLength() - 1,
|
||||
"</div>"
|
||||
);
|
||||
|
||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||
this.element.style.height = config.minHeight + "px";
|
||||
|
||||
var gutterWidth = this.element.offsetWidth;
|
||||
if (this.session.$useWrapMode)
|
||||
lastLineNumber = this.session.getLength();
|
||||
|
||||
var gutterWidth = ("" + lastLineNumber).length * config.characterWidth;
|
||||
var padding = this.$padding || this.$computePadding();
|
||||
gutterWidth += padding.left + padding.right;
|
||||
if (gutterWidth !== this.gutterWidth) {
|
||||
this.gutterWidth = gutterWidth;
|
||||
this.element.style.width = Math.ceil(this.gutterWidth) + "px";
|
||||
this._emit("changeGutterWidth", gutterWidth);
|
||||
}
|
||||
};
|
||||
@@ -174,12 +188,32 @@ var Gutter = function(parentEl) {
|
||||
dom.removeCssClass(this.element, "ace_folding-enabled");
|
||||
|
||||
this.$showFoldWidgets = show;
|
||||
this.$padding = null;
|
||||
};
|
||||
|
||||
this.getShowFoldWidgets = function() {
|
||||
return this.$showFoldWidgets;
|
||||
};
|
||||
|
||||
this.$computePadding = function() {
|
||||
if (!this.element.firstChild)
|
||||
return {left: 0, right: 0};
|
||||
var style = dom.computedStyle(this.element.firstChild);
|
||||
this.$padding = {}
|
||||
this.$padding.left = parseInt(style.paddingLeft) + 1;
|
||||
this.$padding.right = parseInt(style.paddingRight);
|
||||
return this.$padding;
|
||||
};
|
||||
|
||||
this.getRegion = function(point) {
|
||||
var padding = this.$padding || this.$computePadding();
|
||||
var rect = this.element.getBoundingClientRect();
|
||||
if (point.x < padding.left + rect.left)
|
||||
return "markers";
|
||||
if (this.$showFoldWidgets && point.x > rect.right - padding.right)
|
||||
return "foldWidgets";
|
||||
};
|
||||
|
||||
}).call(Gutter.prototype);
|
||||
|
||||
exports.Gutter = Gutter;
|
||||
|
||||
@@ -1,39 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -87,26 +78,17 @@ var Marker = function(parentEl) {
|
||||
range = range.toScreenRange(this.session);
|
||||
if (marker.renderer) {
|
||||
var top = this.$getTop(range.start.row, config);
|
||||
var left = Math.round(
|
||||
this.$padding + range.start.column * config.characterWidth
|
||||
);
|
||||
var left = this.$padding + range.start.column * config.characterWidth;
|
||||
marker.renderer(html, range, left, top, config);
|
||||
}
|
||||
else if (range.isMultiLine()) {
|
||||
if (marker.type == "text") {
|
||||
} else if (marker.type == "fullLine") {
|
||||
this.drawFullLineMarker(html, range, marker.clazz, config);
|
||||
} else if (range.isMultiLine()) {
|
||||
if (marker.type == "text")
|
||||
this.drawTextMarker(html, range, marker.clazz, config);
|
||||
} else {
|
||||
this.drawMultiLineMarker(
|
||||
html, range, marker.clazz, config,
|
||||
marker.type
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.drawSingleLineMarker(
|
||||
html, range, marker.clazz + " start", config,
|
||||
null, marker.type
|
||||
);
|
||||
else
|
||||
this.drawMultiLineMarker(html, range, marker.clazz, config);
|
||||
} else {
|
||||
this.drawSingleLineMarker(html, range, marker.clazz + " ace_start", config);
|
||||
}
|
||||
}
|
||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||
@@ -125,7 +107,7 @@ var Marker = function(parentEl) {
|
||||
row, range.start.column,
|
||||
row, this.session.getScreenLastRowColumn(row)
|
||||
);
|
||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " start", layerConfig, 1, "text");
|
||||
this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " ace_start", layerConfig, 1, "text");
|
||||
|
||||
// selection end
|
||||
row = range.end.row;
|
||||
@@ -142,14 +124,14 @@ var Marker = function(parentEl) {
|
||||
|
||||
// Draws a multi line marker, where lines span the full width
|
||||
this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, type) {
|
||||
var padding = type === "background" ? 0 : this.$padding;
|
||||
// from selection start to the end of the line
|
||||
var padding = this.$padding;
|
||||
var height = config.lineHeight;
|
||||
var top = this.$getTop(range.start.row, config);
|
||||
var left = Math.round(padding + range.start.column * config.characterWidth);
|
||||
var left = padding + range.start.column * config.characterWidth;
|
||||
|
||||
stringBuilder.push(
|
||||
"<div class='", clazz, " start' style='",
|
||||
"<div class='", clazz, " ace_start' style='",
|
||||
"height:", height, "px;",
|
||||
"right:0;",
|
||||
"top:", top, "px;",
|
||||
@@ -158,7 +140,7 @@ var Marker = function(parentEl) {
|
||||
|
||||
// from start of the last line to the selection end
|
||||
top = this.$getTop(range.end.row, config);
|
||||
var width = Math.round(range.end.column * config.characterWidth);
|
||||
var width = range.end.column * config.characterWidth;
|
||||
|
||||
stringBuilder.push(
|
||||
"<div class='", clazz, "' style='",
|
||||
@@ -184,19 +166,12 @@ var Marker = function(parentEl) {
|
||||
};
|
||||
|
||||
// Draws a marker which covers part or whole width of a single screen line
|
||||
this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength, type) {
|
||||
var padding = type === "background" ? 0 : this.$padding;
|
||||
var height = layerConfig.lineHeight;
|
||||
this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength) {
|
||||
var height = config.lineHeight;
|
||||
var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth;
|
||||
|
||||
if (type === "background")
|
||||
var width = layerConfig.width;
|
||||
else
|
||||
width = Math.round((range.end.column + (extraLength || 0) - range.start.column) * layerConfig.characterWidth);
|
||||
|
||||
var top = this.$getTop(range.start.row, layerConfig);
|
||||
var left = Math.round(
|
||||
padding + range.start.column * layerConfig.characterWidth
|
||||
);
|
||||
var top = this.$getTop(range.start.row, config);
|
||||
var left = this.$padding + range.start.column * config.characterWidth;
|
||||
|
||||
stringBuilder.push(
|
||||
"<div class='", clazz, "' style='",
|
||||
@@ -207,6 +182,20 @@ var Marker = function(parentEl) {
|
||||
);
|
||||
};
|
||||
|
||||
this.drawFullLineMarker = function(stringBuilder, range, clazz, config) {
|
||||
var top = this.$getTop(range.start.row, config);
|
||||
var height = config.lineHeight;
|
||||
if (range.start.row != range.end.row)
|
||||
height += this.$getTop(range.end.row, config) - top;
|
||||
|
||||
stringBuilder.push(
|
||||
"<div class='", clazz, "' style='",
|
||||
"height:", height, "px;",
|
||||
"top:", top, "px;",
|
||||
"left:0;right:0;'></div>"
|
||||
);
|
||||
}
|
||||
|
||||
}).call(Marker.prototype);
|
||||
|
||||
exports.Marker = Marker;
|
||||
|
||||
@@ -1,41 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian DOT viereck AT gmail DOT com>
|
||||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -53,7 +42,8 @@ var Text = function(parentEl) {
|
||||
this.element.className = "ace_layer ace_text-layer";
|
||||
parentEl.appendChild(this.element);
|
||||
|
||||
this.$characterSize = this.$measureSizes() || {width: 0, height: 0};
|
||||
this.$characterSize = {width: 0, height: 0};
|
||||
this.checkForSizeChanges();
|
||||
this.$pollSizeChanges();
|
||||
};
|
||||
|
||||
@@ -83,7 +73,11 @@ var Text = function(parentEl) {
|
||||
this.checkForSizeChanges = function() {
|
||||
var size = this.$measureSizes();
|
||||
if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
|
||||
this.$measureNode.style.fontWeight = "bold";
|
||||
var boldSize = this.$measureSizes();
|
||||
this.$measureNode.style.fontWeight = "";
|
||||
this.$characterSize = size;
|
||||
this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;
|
||||
this._emit("changeCharacterSize", {data: size});
|
||||
}
|
||||
};
|
||||
@@ -196,6 +190,7 @@ var Text = function(parentEl) {
|
||||
|
||||
this.setSession = function(session) {
|
||||
this.session = session;
|
||||
this.$computeTabString();
|
||||
};
|
||||
|
||||
this.showInvisibles = false;
|
||||
@@ -204,28 +199,52 @@ var Text = function(parentEl) {
|
||||
return false;
|
||||
|
||||
this.showInvisibles = showInvisibles;
|
||||
this.$computeTabString();
|
||||
return true;
|
||||
};
|
||||
|
||||
this.displayIndentGuides = true;
|
||||
this.setDisplayIndentGuides = function(display) {
|
||||
if (this.displayIndentGuides == display)
|
||||
return false;
|
||||
|
||||
this.displayIndentGuides = display;
|
||||
this.$computeTabString();
|
||||
return true;
|
||||
};
|
||||
|
||||
this.$tabStrings = [];
|
||||
this.onChangeTabSize =
|
||||
this.$computeTabString = function() {
|
||||
var tabSize = this.session.getTabSize();
|
||||
this.tabSize = tabSize;
|
||||
var tabStr = this.$tabStrings = [0];
|
||||
for (var i = 1; i < tabSize + 1; i++) {
|
||||
if (this.showInvisibles) {
|
||||
tabStr.push("<span class='ace_invisible'>"
|
||||
+ this.TAB_CHAR
|
||||
+ new Array(i).join(" ")
|
||||
+ Array(i).join(" ")
|
||||
+ "</span>");
|
||||
} else {
|
||||
tabStr.push(new Array(i+1).join(" "));
|
||||
}
|
||||
}
|
||||
if (this.displayIndentGuides) {
|
||||
this.$indentGuideRe = /\s\S| \t|\t |\s$/;
|
||||
var className = "ace_indent-guide";
|
||||
var content = Array(this.tabSize + 1).join(" ");
|
||||
var tabContent = content;
|
||||
if (this.showInvisibles) {
|
||||
className += " ace_invisible";
|
||||
tabContent = this.TAB_CHAR + content.substr(6);
|
||||
}
|
||||
|
||||
this.$tabStrings[" "] = "<span class='" + className + "'>" + content + "</span>";
|
||||
this.$tabStrings["\t"] = "<span class='" + className + "'>" + tabContent + "</span>";
|
||||
}
|
||||
};
|
||||
|
||||
this.updateLines = function(config, firstRow, lastRow) {
|
||||
this.$computeTabString();
|
||||
// Due to wrap line changes there can be new lines if e.g.
|
||||
// the line to updated wrapped in the meantime.
|
||||
if (this.config.lastRow != config.lastRow ||
|
||||
@@ -253,22 +272,32 @@ var Text = function(parentEl) {
|
||||
lineElementsIdx ++;
|
||||
}
|
||||
|
||||
for (var i=first; i<=last; i++) {
|
||||
var row = first;
|
||||
var foldLine = this.session.getNextFoldLine(row);
|
||||
var foldStart = foldLine ? foldLine.start.row : Infinity;
|
||||
|
||||
while (true) {
|
||||
if (row > foldStart) {
|
||||
row = foldLine.end.row+1;
|
||||
foldLine = this.session.getNextFoldLine(row, foldLine);
|
||||
foldStart = foldLine ? foldLine.start.row :Infinity;
|
||||
}
|
||||
if (row > last)
|
||||
break;
|
||||
|
||||
var lineElement = lineElements[lineElementsIdx++];
|
||||
if (!lineElement)
|
||||
continue;
|
||||
|
||||
var html = [];
|
||||
var tokens = this.session.getTokens(i);
|
||||
this.$renderLine(html, i, tokens, !this.$useLineGroups());
|
||||
lineElement = dom.setInnerHtml(lineElement, html.join(""));
|
||||
|
||||
i = this.session.getRowFoldEnd(i);
|
||||
if (lineElement) {
|
||||
var html = [];
|
||||
this.$renderLine(
|
||||
html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false
|
||||
);
|
||||
dom.setInnerHtml(lineElement, html.join(""));
|
||||
}
|
||||
row++;
|
||||
}
|
||||
};
|
||||
|
||||
this.scrollLines = function(config) {
|
||||
this.$computeTabString();
|
||||
var oldConfig = this.config;
|
||||
this.config = config;
|
||||
|
||||
@@ -321,8 +350,7 @@ var Text = function(parentEl) {
|
||||
var html = [];
|
||||
// Get the tokens per line as there might be some lines in between
|
||||
// beeing folded.
|
||||
var tokens = this.session.getTokens(row);
|
||||
this.$renderLine(html, row, tokens, false);
|
||||
this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
|
||||
|
||||
// don't use setInnerHtml since we are working with an empty DIV
|
||||
container.innerHTML = html.join("");
|
||||
@@ -341,7 +369,6 @@ var Text = function(parentEl) {
|
||||
};
|
||||
|
||||
this.update = function(config) {
|
||||
this.$computeTabString();
|
||||
this.config = config;
|
||||
|
||||
var html = [];
|
||||
@@ -363,10 +390,7 @@ var Text = function(parentEl) {
|
||||
if (this.$useLineGroups())
|
||||
html.push("<div class='ace_line_group'>")
|
||||
|
||||
// Get the tokens per line as there might be some lines in between
|
||||
// beeing folded.
|
||||
var tokens = this.session.getTokens(row);
|
||||
this.$renderLine(html, row, tokens, false);
|
||||
this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
|
||||
|
||||
if (this.$useLineGroups())
|
||||
html.push("</div>"); // end the line group
|
||||
@@ -384,7 +408,7 @@ var Text = function(parentEl) {
|
||||
|
||||
this.$renderToken = function(stringBuilder, screenColumn, token, value) {
|
||||
var self = this;
|
||||
var replaceReg = /\t|&|<|( +)|([\u0000-\u0019\u00a0\u1680\u180E\u2000-\u200b\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
|
||||
var replaceReg = /\t|&|<|( +)|([\x00-\x1f\x80-\xa0\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
|
||||
var replaceFunc = function(c, a, b, tabIdx, idx4) {
|
||||
if (a) {
|
||||
return new Array(c.length+1).join(" ");
|
||||
@@ -429,38 +453,44 @@ var Text = function(parentEl) {
|
||||
return screenColumn + value.length;
|
||||
};
|
||||
|
||||
this.$renderLineCore = function(stringBuilder, lastRow, tokens, splits, onlyContents) {
|
||||
this.renderIndentGuide = function(stringBuilder, value) {
|
||||
var cols = value.search(this.$indentGuideRe);
|
||||
if (cols <= 0)
|
||||
return value;
|
||||
if (value[0] == " ") {
|
||||
cols -= cols % this.tabSize;
|
||||
stringBuilder.push(Array(cols/this.tabSize + 1).join(this.$tabStrings[" "]));
|
||||
return value.substr(cols);
|
||||
} else if (value[0] == "\t") {
|
||||
stringBuilder.push(Array(cols + 1).join(this.$tabStrings["\t"]));
|
||||
return value.substr(cols);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) {
|
||||
var chars = 0;
|
||||
var split = 0;
|
||||
var splitChars;
|
||||
var splitChars = splits[0];
|
||||
var screenColumn = 0;
|
||||
var self = this;
|
||||
|
||||
if (!splits || splits.length == 0)
|
||||
splitChars = Number.MAX_VALUE;
|
||||
else
|
||||
splitChars = splits[0];
|
||||
|
||||
if (!onlyContents) {
|
||||
stringBuilder.push("<div class='ace_line' style='height:",
|
||||
this.config.lineHeight, "px",
|
||||
"'>"
|
||||
);
|
||||
}
|
||||
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
var token = tokens[i];
|
||||
var value = token.value;
|
||||
if (i == 0 && this.displayIndentGuides) {
|
||||
chars = value.length;
|
||||
value = this.renderIndentGuide(stringBuilder, value);
|
||||
if (!value)
|
||||
continue;
|
||||
chars -= value.length;
|
||||
}
|
||||
|
||||
if (chars + value.length < splitChars) {
|
||||
screenColumn = self.$renderToken(
|
||||
stringBuilder, screenColumn, token, value
|
||||
);
|
||||
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
|
||||
chars += value.length;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
while (chars + value.length >= splitChars) {
|
||||
screenColumn = self.$renderToken(
|
||||
screenColumn = this.$renderToken(
|
||||
stringBuilder, screenColumn,
|
||||
token, value.substring(0, splitChars - chars)
|
||||
);
|
||||
@@ -470,8 +500,7 @@ var Text = function(parentEl) {
|
||||
if (!onlyContents) {
|
||||
stringBuilder.push("</div>",
|
||||
"<div class='ace_line' style='height:",
|
||||
this.config.lineHeight, "px",
|
||||
"'>"
|
||||
this.config.lineHeight, "px'>"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -481,37 +510,70 @@ var Text = function(parentEl) {
|
||||
}
|
||||
if (value.length != 0) {
|
||||
chars += value.length;
|
||||
screenColumn = self.$renderToken(
|
||||
screenColumn = this.$renderToken(
|
||||
stringBuilder, screenColumn, token, value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.$renderSimpleLine = function(stringBuilder, tokens) {
|
||||
var screenColumn = 0;
|
||||
var token = tokens[0];
|
||||
var value = token.value;
|
||||
if (this.displayIndentGuides)
|
||||
value = this.renderIndentGuide(stringBuilder, value);
|
||||
if (value)
|
||||
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
|
||||
for (var i = 1; i < tokens.length; i++) {
|
||||
token = tokens[i];
|
||||
value = token.value;
|
||||
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
|
||||
}
|
||||
};
|
||||
|
||||
// row is either first row of foldline or not in fold
|
||||
this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) {
|
||||
if (!foldLine && foldLine != false)
|
||||
foldLine = this.session.getFoldLine(row);
|
||||
|
||||
if (foldLine)
|
||||
var tokens = this.$getFoldLineTokens(row, foldLine);
|
||||
else
|
||||
var tokens = this.session.getTokens(row);
|
||||
|
||||
|
||||
if (!onlyContents) {
|
||||
stringBuilder.push(
|
||||
"<div class='ace_line' style='height:", this.config.lineHeight, "px'>"
|
||||
);
|
||||
}
|
||||
|
||||
if (tokens.length) {
|
||||
var splits = this.session.getRowSplitData(row);
|
||||
if (splits && splits.length)
|
||||
this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents);
|
||||
else
|
||||
this.$renderSimpleLine(stringBuilder, tokens);
|
||||
}
|
||||
|
||||
if (this.showInvisibles) {
|
||||
if (lastRow !== this.session.getLength() - 1)
|
||||
stringBuilder.push("<span class='ace_invisible'>" + this.EOL_CHAR + "</span>");
|
||||
else
|
||||
stringBuilder.push("<span class='ace_invisible'>" + this.EOF_CHAR + "</span>");
|
||||
if (foldLine)
|
||||
row = foldLine.end.row
|
||||
|
||||
stringBuilder.push(
|
||||
"<span class='ace_invisible'>",
|
||||
row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR,
|
||||
"</span>"
|
||||
);
|
||||
}
|
||||
if (!onlyContents)
|
||||
stringBuilder.push("</div>");
|
||||
};
|
||||
|
||||
this.$renderLine = function(stringBuilder, row, tokens, onlyContents) {
|
||||
// Check if the line to render is folded or not. If not, things are
|
||||
// simple, otherwise, we need to fake some things...
|
||||
if (!this.session.isRowFolded(row)) {
|
||||
var splits = this.session.getRowSplitData(row);
|
||||
this.$renderLineCore(stringBuilder, row, tokens, splits, onlyContents);
|
||||
} else {
|
||||
this.$renderFoldLine(stringBuilder, row, tokens, onlyContents);
|
||||
}
|
||||
};
|
||||
|
||||
this.$renderFoldLine = function(stringBuilder, row, tokens, onlyContents) {
|
||||
this.$getFoldLineTokens = function(row, foldLine) {
|
||||
var session = this.session;
|
||||
var foldLine = session.getFoldLine(row);
|
||||
var renderTokens = [];
|
||||
|
||||
function addTokens(tokens, from, to) {
|
||||
@@ -552,8 +614,9 @@ var Text = function(parentEl) {
|
||||
}
|
||||
}
|
||||
|
||||
var tokens = session.getTokens(row);
|
||||
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
|
||||
if (placeholder) {
|
||||
if (placeholder != null) {
|
||||
renderTokens.push({
|
||||
type: "fold",
|
||||
value: placeholder
|
||||
@@ -567,9 +630,7 @@ var Text = function(parentEl) {
|
||||
}
|
||||
}, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
|
||||
|
||||
// splits for foldline are stored at its' first row
|
||||
var splits = this.session.$useWrapMode ? this.session.$wrapData[row] : null;
|
||||
this.$renderLineCore(stringBuilder, row, renderTokens, splits, onlyContents);
|
||||
return renderTokens;
|
||||
};
|
||||
|
||||
this.$useLineGroups = function() {
|
||||
|
||||
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -67,35 +60,61 @@ module.exports = {
|
||||
this.textLayer.$computeTabString();
|
||||
|
||||
// row with hard tabs
|
||||
var row = 0;
|
||||
var tokens = this.session.getTokens(row);
|
||||
var stringBuilder = [];
|
||||
this.textLayer.$renderLine(stringBuilder, row, tokens);
|
||||
this.textLayer.$renderLine(stringBuilder, 0);
|
||||
|
||||
// row with soft tabs
|
||||
row = 1;
|
||||
tokens = this.session.getTokens(row);
|
||||
var stringBuilder2 = [];
|
||||
this.textLayer.$renderLine(stringBuilder2, row, tokens);
|
||||
this.textLayer.$renderLine(stringBuilder2, 1);
|
||||
assert.equal(stringBuilder.join(""), stringBuilder2.join(""));
|
||||
},
|
||||
|
||||
"test rendering width of ideographic space (U+3000)" : function() {
|
||||
this.session.setValue("\u3000");
|
||||
|
||||
var tokens = this.session.getTokens(0);
|
||||
var stringBuilder = [];
|
||||
this.textLayer.$renderLine(stringBuilder, 0, tokens, true);
|
||||
this.textLayer.$renderLine(stringBuilder, 0, true);
|
||||
assert.equal(stringBuilder.join(""), "<span class='ace_cjk' style='width:20px'></span>");
|
||||
|
||||
this.textLayer.setShowInvisibles(true);
|
||||
var stringBuilder = [];
|
||||
this.textLayer.$renderLine(stringBuilder, 0, tokens, true);
|
||||
this.textLayer.$renderLine(stringBuilder, 0, true);
|
||||
assert.equal(
|
||||
stringBuilder.join(""),
|
||||
"<span class='ace_cjk ace_invisible' style='width:20px'>" + this.textLayer.SPACE_CHAR + "</span>"
|
||||
+ "<span class='ace_invisible'>\xB6</span>"
|
||||
);
|
||||
},
|
||||
|
||||
"test rendering of indent guides" : function() {
|
||||
var textLayer = this.textLayer
|
||||
var EOL = "<span class='ace_invisible'>" + textLayer.EOL_CHAR + "</span>";
|
||||
var SPACE = function(i) {return Array(i+1).join(" ")}
|
||||
var TAB = function(i) {return textLayer.TAB_CHAR + SPACE(i-1)}
|
||||
function testRender(results) {
|
||||
for (var i = results.length; i--; ) {
|
||||
var stringBuilder = [];
|
||||
textLayer.$renderLine(stringBuilder, i, true);
|
||||
assert.equal(stringBuilder.join(""), results[i]);
|
||||
}
|
||||
}
|
||||
|
||||
this.session.setValue(" \n\t\tf\n ");
|
||||
testRender([
|
||||
"<span class='ace_indent-guide'>" + SPACE(4) + "</span>" + SPACE(2),
|
||||
"<span class='ace_indent-guide'>" + SPACE(4) + "</span>" + SPACE(4) + "<span class='ace_identifier'>f</span>",
|
||||
SPACE(3)
|
||||
]);
|
||||
this.textLayer.setShowInvisibles(true);
|
||||
testRender([
|
||||
"<span class='ace_indent-guide ace_invisible'>" + SPACE(4) + "</span>" + SPACE(2) + EOL,
|
||||
"<span class='ace_indent-guide ace_invisible'>" + TAB(4) + "</span><span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_identifier'>f</span>" + EOL,
|
||||
]);
|
||||
this.textLayer.setDisplayIndentGuides(false);
|
||||
testRender([
|
||||
SPACE(6) + EOL,
|
||||
"<span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_identifier'>f</span>" + EOL
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,40 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
@@ -1,40 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Mihai Sucan <mihai AT sucan AT gmail ODT com>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
@@ -543,10 +543,33 @@ if (!Object.getOwnPropertyNames) {
|
||||
// ES5 15.2.3.5
|
||||
// http://es5.github.com/#x15.2.3.5
|
||||
if (!Object.create) {
|
||||
var createEmpty;
|
||||
if (Object.prototype.__proto__ === null) {
|
||||
createEmpty = function () {
|
||||
return { "__proto__": null };
|
||||
};
|
||||
} else {
|
||||
// In old IE __proto__ can't be used to manually set `null`
|
||||
createEmpty = function () {
|
||||
var empty = {};
|
||||
for (var i in empty)
|
||||
empty[i] = null;
|
||||
empty.constructor =
|
||||
empty.hasOwnProperty =
|
||||
empty.propertyIsEnumerable =
|
||||
empty.isPrototypeOf =
|
||||
empty.toLocaleString =
|
||||
empty.toString =
|
||||
empty.valueOf =
|
||||
empty.__proto__ = null;
|
||||
return empty;
|
||||
}
|
||||
}
|
||||
|
||||
Object.create = function create(prototype, properties) {
|
||||
var object;
|
||||
if (prototype === null) {
|
||||
object = { "__proto__": null };
|
||||
object = createEmpty();
|
||||
} else {
|
||||
if (typeof prototype != "object")
|
||||
throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
|
||||
|
||||
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -108,11 +101,6 @@ exports.getButton = function(e) {
|
||||
|
||||
if (document.documentElement.setCapture) {
|
||||
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
|
||||
function onMouseMove(e) {
|
||||
eventHandler(e);
|
||||
return exports.stopPropagation(e);
|
||||
}
|
||||
|
||||
var called = false;
|
||||
function onReleaseCapture(e) {
|
||||
eventHandler(e);
|
||||
@@ -137,22 +125,17 @@ if (document.documentElement.setCapture) {
|
||||
}
|
||||
else {
|
||||
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
|
||||
function onMouseMove(e) {
|
||||
eventHandler(e);
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function onMouseUp(e) {
|
||||
eventHandler && eventHandler(e);
|
||||
releaseCaptureHandler && releaseCaptureHandler(e);
|
||||
|
||||
document.removeEventListener("mousemove", onMouseMove, true);
|
||||
document.removeEventListener("mousemove", eventHandler, true);
|
||||
document.removeEventListener("mouseup", onMouseUp, true);
|
||||
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
document.addEventListener("mousemove", onMouseMove, true);
|
||||
document.addEventListener("mousemove", eventHandler, true);
|
||||
document.addEventListener("mouseup", onMouseUp, true);
|
||||
};
|
||||
}
|
||||
@@ -193,7 +176,7 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
|
||||
4: "quadclick"
|
||||
};
|
||||
|
||||
var listener = function(e) {
|
||||
exports.addListener(el, "mousedown", function(e) {
|
||||
if (exports.getButton(e) != 0) {
|
||||
clicks = 0;
|
||||
} else {
|
||||
@@ -219,10 +202,18 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
|
||||
clicks = 0;
|
||||
else if (clicks > 1)
|
||||
return eventHandler[callbackName](eventNames[clicks], e);
|
||||
};
|
||||
});
|
||||
|
||||
exports.addListener(el, "mousedown", listener);
|
||||
useragent.isOldIE && exports.addListener(el, "dblclick", listener);
|
||||
if (useragent.isOldIE) {
|
||||
exports.addListener(el, "dblclick", function(e) {
|
||||
clicks = 2;
|
||||
if (timer)
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
|
||||
eventHandler[callbackName]("mousedown", e);
|
||||
eventHandler[callbackName](eventNames[clicks], e);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function normalizeCommandKeys(callback, e, keyCode) {
|
||||
@@ -292,11 +283,11 @@ exports.addCommandKeyListener = function(el, callback) {
|
||||
}
|
||||
};
|
||||
|
||||
if (window.postMessage) {
|
||||
if (window.postMessage && !useragent.isOldIE) {
|
||||
var postMessageId = 1;
|
||||
exports.nextTick = function(callback, win) {
|
||||
win = win || window;
|
||||
var messageName = "zero-timeout-message-" + postMessageId;
|
||||
var messageName = "zero-timeout-message-" + postMessageId;
|
||||
exports.addListener(win, "message", function listener(e) {
|
||||
if (e.data == messageName) {
|
||||
exports.stopPropagation(e);
|
||||
@@ -307,11 +298,18 @@ if (window.postMessage) {
|
||||
win.postMessage(messageName, "*");
|
||||
};
|
||||
}
|
||||
else {
|
||||
exports.nextTick = function(callback, win) {
|
||||
win = win || window;
|
||||
window.setTimeout(callback, 0);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
exports.nextFrame = window.requestAnimationFrame ||
|
||||
window.oRequestAnimationFrame ||
|
||||
window.msRequestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.webkitRequestAnimationFrame;
|
||||
|
||||
if (exports.nextFrame)
|
||||
exports.nextFrame = exports.nextFrame.bind(window);
|
||||
else
|
||||
exports.nextFrame = function(callback) {
|
||||
setTimeout(callback, 17);
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,40 +1,30 @@
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Mike de Boer <mike AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -53,8 +43,11 @@ EventEmitter._dispatchEvent = function(eventName, e) {
|
||||
if (!listeners.length && !defaultHandler)
|
||||
return;
|
||||
|
||||
e = e || {};
|
||||
e.type = eventName;
|
||||
if (typeof e != "object" || !e)
|
||||
e = {};
|
||||
|
||||
if (!e.type)
|
||||
e.type = eventName;
|
||||
|
||||
if (!e.stopPropagation) {
|
||||
e.stopPropagation = function() {
|
||||
@@ -93,7 +86,7 @@ EventEmitter.addEventListener = function(eventName, callback) {
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners)
|
||||
var listeners = this._eventRegistry[eventName] = [];
|
||||
listeners = this._eventRegistry[eventName] = [];
|
||||
|
||||
if (listeners.indexOf(callback) == -1)
|
||||
listeners.push(callback);
|
||||
|
||||
+25
-32
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ var Keys = (function() {
|
||||
|
||||
// A reverse map of FUNCTION_KEYS
|
||||
for (var i in ret.FUNCTION_KEYS) {
|
||||
var name = ret.FUNCTION_KEYS[i].toUpperCase();
|
||||
var name = ret.FUNCTION_KEYS[i].toLowerCase();
|
||||
ret[name] = parseInt(i, 10);
|
||||
}
|
||||
|
||||
@@ -118,6 +118,14 @@ var Keys = (function() {
|
||||
oop.mixin(ret, ret.PRINTABLE_KEYS);
|
||||
oop.mixin(ret, ret.FUNCTION_KEYS);
|
||||
|
||||
// aliases
|
||||
ret.enter = ret["return"];
|
||||
ret.escape = ret.esc;
|
||||
ret.del = ret["delete"];
|
||||
|
||||
// workaround for firefox bug
|
||||
ret[173] = '-';
|
||||
|
||||
return ret;
|
||||
})();
|
||||
oop.mixin(exports, Keys);
|
||||
|
||||
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@@ -101,6 +94,14 @@ exports.arrayToMap = function(arr) {
|
||||
|
||||
};
|
||||
|
||||
exports.createMap = function(props) {
|
||||
var map = Object.create(null);
|
||||
for (var i in props) {
|
||||
map[i] = props[i];
|
||||
}
|
||||
return map;
|
||||
};
|
||||
|
||||
/*
|
||||
* splice out of 'array' anything that === 'value'
|
||||
*/
|
||||
@@ -116,6 +117,10 @@ exports.escapeRegExp = function(str) {
|
||||
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
|
||||
};
|
||||
|
||||
exports.escapeHTML = function(str) {
|
||||
return str.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<");
|
||||
};
|
||||
|
||||
exports.getMatchOffsets = function(string, regExp) {
|
||||
var matches = [];
|
||||
|
||||
@@ -129,7 +134,7 @@ exports.getMatchOffsets = function(string, regExp) {
|
||||
return matches;
|
||||
};
|
||||
|
||||
|
||||
/* deprecated */
|
||||
exports.deferredCall = function(fcn) {
|
||||
|
||||
var timer = null;
|
||||
@@ -161,4 +166,39 @@ exports.deferredCall = function(fcn) {
|
||||
return deferred;
|
||||
};
|
||||
|
||||
|
||||
exports.delayedCall = function(fcn, defaultTimeout) {
|
||||
var timer = null;
|
||||
var callback = function() {
|
||||
timer = null;
|
||||
fcn();
|
||||
};
|
||||
|
||||
var _self = function(timeout) {
|
||||
timer && clearTimeout(timer);
|
||||
timer = setTimeout(callback, timeout || defaultTimeout);
|
||||
};
|
||||
|
||||
_self.delay = delayed;
|
||||
_self.schedule = function(timeout) {
|
||||
if (timer == null)
|
||||
timer = setTimeout(callback, timeout || 0);
|
||||
};
|
||||
|
||||
_self.call = function() {
|
||||
this.cancel();
|
||||
fcn();
|
||||
};
|
||||
|
||||
_self.cancel = function() {
|
||||
timer && clearTimeout(timer);
|
||||
timer = null;
|
||||
};
|
||||
|
||||
_self.isPending = function() {
|
||||
return timer;
|
||||
};
|
||||
|
||||
return _self;
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* based on code from:
|
||||
*
|
||||
*
|
||||
* @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/requirejs for details
|
||||
@@ -8,6 +8,8 @@
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var useragent = require("./useragent");
|
||||
|
||||
exports.get = function (url, callback) {
|
||||
var xhr = exports.createXhr();
|
||||
xhr.open('GET', url, true);
|
||||
@@ -55,8 +57,13 @@ exports.loadScript = function(path, callback) {
|
||||
|
||||
s.src = path;
|
||||
head.appendChild(s);
|
||||
|
||||
s.onload = callback;
|
||||
|
||||
if (useragent.isOldIE)
|
||||
s.onreadystatechange = function () {
|
||||
this.readyState == 'loaded' && callback();
|
||||
};
|
||||
else
|
||||
s.onload = callback;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -1,37 +1,30 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ define(function(require, exports, module) {
|
||||
(regex.multiline ? "m" : "") +
|
||||
(regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
|
||||
(regex.sticky ? "y" : "");
|
||||
};
|
||||
}
|
||||
|
||||
function indexOf (array, item, from) {
|
||||
if (Array.prototype.indexOf) // Use the native array method if available
|
||||
@@ -108,6 +108,6 @@ define(function(require, exports, module) {
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -1,43 +1,66 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
* Distributed under the BSD license:
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
* Copyright (c) 2010, Ajax.org B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Ajax.org B.V. nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* I hate doing this, but we need some way to determine if the user is on a Mac
|
||||
* The reason is that users have different expectations of their key combinations.
|
||||
*
|
||||
* Take copy as an example, Mac people expect to use CMD or APPLE + C
|
||||
* Windows folks expect to use CTRL + C
|
||||
*/
|
||||
exports.OS = {
|
||||
LINUX: "LINUX",
|
||||
MAC: "MAC",
|
||||
WINDOWS: "WINDOWS"
|
||||
};
|
||||
|
||||
/*
|
||||
* Return an exports.OS constant
|
||||
*/
|
||||
exports.getOS = function() {
|
||||
if (exports.isMac) {
|
||||
return exports.OS.MAC;
|
||||
} else if (exports.isLinux) {
|
||||
return exports.OS.LINUX;
|
||||
} else {
|
||||
return exports.OS.WINDOWS;
|
||||
}
|
||||
};
|
||||
|
||||
// this can be called in non browser environments (e.g. from ace/requirejs/text)
|
||||
if (typeof navigator != "object")
|
||||
return;
|
||||
|
||||
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
|
||||
var ua = navigator.userAgent;
|
||||
|
||||
@@ -76,30 +99,4 @@ exports.isIPad = ua.indexOf("iPad") >= 0;
|
||||
|
||||
exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
|
||||
|
||||
/*
|
||||
* I hate doing this, but we need some way to determine if the user is on a Mac
|
||||
* The reason is that users have different expectations of their key combinations.
|
||||
*
|
||||
* Take copy as an example, Mac people expect to use CMD or APPLE + C
|
||||
* Windows folks expect to use CTRL + C
|
||||
*/
|
||||
exports.OS = {
|
||||
LINUX: "LINUX",
|
||||
MAC: "MAC",
|
||||
WINDOWS: "WINDOWS"
|
||||
};
|
||||
|
||||
/*
|
||||
* Return an exports.OS constant
|
||||
*/
|
||||
exports.getOS = function() {
|
||||
if (exports.isMac) {
|
||||
return exports.OS.MAC;
|
||||
} else if (exports.isLinux) {
|
||||
return exports.OS.LINUX;
|
||||
} else {
|
||||
return exports.OS.WINDOWS;
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "ace-mode-creator",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"connect": "",
|
||||
"socket.io": ""
|
||||
}
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
var fs = require("fs");
|
||||
if (!fs.existsSync)
|
||||
fs.existsSync = require("path").existsSync;
|
||||
|
||||
require("amd-loader");
|
||||
|
||||
var cwd = __dirname + "/";
|
||||
|
||||
function generateTestData() {
|
||||
var root = Array(5).join("../") + "/demo/kitchen-sink/docs";
|
||||
var docs = fs.readdirSync(cwd + root);
|
||||
var specialDocs = fs.readdirSync(cwd);
|
||||
var modes = fs.readdirSync(cwd + "../").filter(function(x){
|
||||
return /^\w+_highlight_rules.js$/.test(x);
|
||||
}).map(function(x) {
|
||||
return x.replace(/_highlight_rules.js$/, "");
|
||||
});
|
||||
|
||||
console.log("Docs:", docs);
|
||||
console.log("Modes:", modes);
|
||||
|
||||
docs.forEach(function(docName) {
|
||||
var p = docName.toLowerCase().split(".");
|
||||
if (!p[1])
|
||||
return;
|
||||
var modeName;
|
||||
if (modes.indexOf(p[0]) != -1)
|
||||
modeName = p[0];
|
||||
else if (modes.indexOf(p[1]) != -1)
|
||||
modeName = p[1];
|
||||
else
|
||||
modeName = {"txt": "text", cpp: "c_cpp"}[p[1]];
|
||||
|
||||
var filePath = "text_" + modeName + ".txt";
|
||||
if (specialDocs.indexOf(filePath) == -1) {
|
||||
filePath = root + "/" + docName;
|
||||
}
|
||||
|
||||
var text = fs.readFileSync(cwd + filePath, "utf8");
|
||||
try {
|
||||
var Mode = require("../" + modeName).Mode;
|
||||
} catch(e) {
|
||||
console.warn("Can't load mode :" + modeName, e);
|
||||
return;
|
||||
}
|
||||
var tokenizer = new Mode().getTokenizer();
|
||||
|
||||
var state = "start";
|
||||
var data = text.split(/\n|\r|\r\n/).map(function(line) {
|
||||
var tokens = tokenizer.getLineTokens(line, state);
|
||||
state = tokens.state;
|
||||
tokens = tokens.tokens;
|
||||
return {
|
||||
state: state,
|
||||
data: tokens.map(function(x) {return [x.type, x.value]})
|
||||
};
|
||||
});
|
||||
var jsonStr = JSON.stringify(data, null, 1);
|
||||
jsonStr = jsonStr.replace(/\n {4}/g, " ").replace(/\n {3}]/g, " ]");
|
||||
fs.writeFileSync(cwd + "tokens_" + modeName + ".json", jsonStr, "utf8");
|
||||
});
|
||||
}
|
||||
|
||||
function test(startAt) {
|
||||
var docs = fs.readdirSync(cwd).filter(function(x) {
|
||||
return /^tokens_\w+.json$/.test(x);
|
||||
});
|
||||
if (startAt && startAt > 1)
|
||||
docs = docs.slice(startAt - 1);
|
||||
docs.forEach(function(x, i) {
|
||||
var modeName = x.match(/tokens_(.*).json/)[1];
|
||||
|
||||
console.log(padNumber(i+1, 3) + ") testing: \u001b[33m" + modeName + "\u001b[0m");
|
||||
|
||||
var text = fs.readFileSync(cwd + x, "utf8");
|
||||
var data = JSON.parse(text);
|
||||
var Mode = require("../" + modeName).Mode;
|
||||
var tokenizer = new Mode().getTokenizer();
|
||||
|
||||
var state = "start";
|
||||
data.forEach(function(lineData) {
|
||||
lineData.values = [];
|
||||
lineData.types = [];
|
||||
lineData.data.forEach(function(x) {
|
||||
lineData.types.push(x[0]);
|
||||
lineData.values.push(x[1]);
|
||||
});
|
||||
|
||||
var line = lineData.values.join("");
|
||||
|
||||
var tokens = tokenizer.getLineTokens(line, state);
|
||||
var values = tokens.tokens.map(function(x) {return x.value;});
|
||||
var types = tokens.tokens.map(function(x) {return x.type;});
|
||||
|
||||
var success = true;
|
||||
testEqual([
|
||||
lineData.state, tokens.state,
|
||||
lineData.types, types,
|
||||
lineData.values, values]);
|
||||
|
||||
state = lineData.state;
|
||||
});
|
||||
});
|
||||
|
||||
console.log("\u001b[32m" + "all ok" + "\u001b[0m");
|
||||
|
||||
function testEqual(a) {
|
||||
var err;
|
||||
if (a[0] !== a[1]) {
|
||||
console.log(a[0],a[1]);
|
||||
err = 1;
|
||||
}
|
||||
|
||||
if ( a[2] + "" !== a[3] + "" || a[4] + "" !== a[5] + "") {
|
||||
arrayDiff(a[2],a[3]);
|
||||
arrayDiff(a[4],a[5]);
|
||||
err = 1;
|
||||
}
|
||||
if (err) {
|
||||
throw "error";
|
||||
}
|
||||
}
|
||||
|
||||
function arrayDiff(a1, a2) {
|
||||
var l = Math.max(a1.length, a2.length);
|
||||
var out = [];
|
||||
for (var i = 0; i < l; i++) {
|
||||
out.push("\n", padNumber(i+1, 3), ") ");
|
||||
if (a1[i] !== a2[i])
|
||||
out.push("\u001b[31m", a1[i], " != ", a2[i], "\u001b[0m");
|
||||
else
|
||||
out.push(a1[i]);
|
||||
}
|
||||
console.log(out.join(""));
|
||||
}
|
||||
function padNumber(num, digits) {
|
||||
return (" " + num).slice(-digits);
|
||||
}
|
||||
}
|
||||
|
||||
if (process.argv[2] == "gen")
|
||||
generateTestData(process.argv.splice(3));
|
||||
else
|
||||
test(parseInt(process.argv[2],10) || 0);
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
function foo(items, nada) {
|
||||
for (var i=0; i<items.length; i++) {
|
||||
alert(items[i] + "juhu\n");
|
||||
} // Real Tab.
|
||||
}
|
||||
|
||||
regexp = /p|p/ // ends here
|
||||
|
||||
r = /d{1,2}?f{e}++r*?\d+?[]r[^r-o\f\f[\f]?r{7}+r\{7}+rr--rr$^(?:d|s)(?=a|)(?!y)[]|$?|^*/ o
|
||||
a=/a/ jk = / / / / /
|
||||
/************************************/
|
||||
/** total mess, tricky to highlight**/
|
||||
|
||||
function () {
|
||||
/**
|
||||
* docComment
|
||||
**/
|
||||
r = /u\t*/
|
||||
g = 1.00E^1, y = 1.2 + .2 + 052 + 0x25
|
||||
t = ['d', '']
|
||||
}
|
||||
function () {
|
||||
/* eee */
|
||||
}
|
||||
|
||||
"s\
|
||||
s\u7824sss\u1"
|
||||
|
||||
'\
|
||||
string'
|
||||
|
||||
'
|
||||
string'
|
||||
|
||||
"trailing space\
|
||||
" " /not a regexp/g
|
||||
|
||||
/**
|
||||
*doc
|
||||
*/
|
||||
|
||||
a = {
|
||||
'a': b,
|
||||
'g': function(t)
|
||||
gta:function(a,b)
|
||||
}
|
||||
|
||||
|
||||
foo.protoype.d = function(a, b,
|
||||
c, d)
|
||||
foo.d =function(a, b)
|
||||
foo.d =function(a, /*****/ d"string"
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "Searching for 'var' in /workspace/configs" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "string", "configs/default.js" ],
|
||||
[ "text", ":" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", " 1" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var fs = require(\"fs\");" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t2" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var argv = require('optimist').argv;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t3" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var path = require(\"path\");" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t5" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var clientExtensions = {};" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t6" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var clientDirs = fs.readdirSync(__dirname + \"/../plugins-client\");" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t7" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "for (var i = 0; i < clientDirs.length; i++) {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t8" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var dir = clientDirs[i];" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t12" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var name = dir.split(\".\")[1];" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t16" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var projectDir = (argv.w && path.resolve(process.cwd(), argv.w)) || process.cwd();" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t17" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var fsUrl = \"/workspace\";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t19" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var port = argv.p || process.env.PORT || 3131;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t20" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var host = argv.l || \"localhost\";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t22" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var config = {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "string", "configs/local.js" ],
|
||||
[ "text", ":" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t2" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var config = require(\"./default\");" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "string", "configs/packed.js" ],
|
||||
[ "text", ":" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "c9searchresults.constant.numeric", "\t1" ],
|
||||
[ "c9searchresults.text", ": " ],
|
||||
[ "c9searchresults.text", "var config = require(\"./default\");" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "Found 15 matches in 3 files" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "// compound assignment operators" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "#include" ],
|
||||
[ "text", " " ],
|
||||
[ "constant", "<iostream>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword.control", "using" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "namespace" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "std" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "storage.type", "int" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.name.function", "main" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "storage.type", "int" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "a" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "b" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "constant.numeric", "3" ],
|
||||
[ "punctuation.operator", ";" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "/*" ],
|
||||
[ "comment", " foobar */" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "a" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "b" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "a" ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "constant.numeric", "2" ],
|
||||
[ "punctuation.operator", ";" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "// equivalent to a=a+2" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "cout" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "<" ],
|
||||
[ "keyword.operator", "<" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "a" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword.control", "return" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+248
@@ -0,0 +1,248 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "(" ],
|
||||
[ "support.function", "defn" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "parting" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "string", "\"returns a String parting in a given language" ],
|
||||
[ "string", "\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "keyword", "[" ],
|
||||
[ "keyword", "]" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "identifier", "parting" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"World" ],
|
||||
[ "string", "\"" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "keyword", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "keyword", "[" ],
|
||||
[ "support.function", "name" ],
|
||||
[ "keyword", "]" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "identifier", "parting" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "name" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"en" ],
|
||||
[ "string", "\"" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "keyword", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "keyword", "[" ],
|
||||
[ "support.function", "name" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "language" ],
|
||||
[ "keyword", "]" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "; condp is similar to a case statement in other languages." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "; It is described in more detail later." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "; It is used here to take different actions based on whether the" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "; parameter \"language\" is set to \"en\", \"es\" or something else." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "support.function", "condp" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.language", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "language" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "string", "\"en" ],
|
||||
[ "string", "\"" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "support.function", "str" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"Goodbye, " ],
|
||||
[ "string", "\"" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "name" ],
|
||||
[ "keyword", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "string", "\"es" ],
|
||||
[ "string", "\"" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "support.function", "str" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"Adios, " ],
|
||||
[ "string", "\"" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "name" ],
|
||||
[ "keyword", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "keyword", "throw" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "identifier", "IllegalArgumentException" ],
|
||||
[ "text", "." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "support.function", "str" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"unsupported language " ],
|
||||
[ "string", "\"" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "language" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "keyword", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "(" ],
|
||||
[ "support.function", "println" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "identifier", "parting" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "; -> Goodbye, World" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "(" ],
|
||||
[ "support.function", "println" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "identifier", "parting" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"Mark" ],
|
||||
[ "string", "\"" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "; -> Goodbye, Mark" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "(" ],
|
||||
[ "support.function", "println" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "identifier", "parting" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"Mark" ],
|
||||
[ "string", "\"" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"es" ],
|
||||
[ "string", "\"" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "; -> Adios, Mark" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "(" ],
|
||||
[ "support.function", "println" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "(" ],
|
||||
[ "identifier", "parting" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"Mark" ],
|
||||
[ "string", "\"" ],
|
||||
[ "text", ", " ],
|
||||
[ "string", "\"xy" ],
|
||||
[ "string", "\"" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "keyword", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "; -> java.lang.IllegalArgumentException: unsupported language xy" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+188
@@ -0,0 +1,188 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "#!/usr/bin/env coffee" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "try" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "throw" ],
|
||||
[ "text", " " ],
|
||||
[ "language.support.class", "URIError" ],
|
||||
[ "text", " " ],
|
||||
[ "language.support.function", "decodeURI" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.numeric", "0xC0ffee" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "*" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "123456.7e-8" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "/" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", ".9" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "catch" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "e" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "qdoc",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "console" ],
|
||||
[ "identifier", ".log" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "'qstring'" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"qqstring\"" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "'''" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "qdoc",
|
||||
"data": [
|
||||
[ "string", " qdoc" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "qqdoc",
|
||||
"data": [
|
||||
[ "string", " '''" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"\"\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "qqdoc",
|
||||
"data": [
|
||||
[ "string", " qqdoc" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "string", " \"\"\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "do" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "->" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "###" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "comment", " herecomment" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", " ###" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "heregex",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "re" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "string.regex", "/regex/imgy" ],
|
||||
[ "identifier", ".test" ],
|
||||
[ "text", " " ],
|
||||
[ "string.regex", "///" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "heregex",
|
||||
"data": [
|
||||
[ "comment.regex", " " ],
|
||||
[ "string.regex", "heregex" ],
|
||||
[ "comment.regex", " # comment" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "string.regex", " ///imgy" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "this" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "isnt" ],
|
||||
[ "punctuation.operator", ":" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "`just JavaScript`" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "constant.language", "undefined" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "identifier", "sentence" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"#{ 22 / 7 } is a decent approximation of π\"" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "<!--" ],
|
||||
[ "comment", "- hello world --->" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "cfset" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "welcome" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"Hello World!\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "cfoutput" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "#welcome#" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "cfoutput" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "public" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "void" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "HelloWorld" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "//Say Hello!" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "Console" ],
|
||||
[ "punctuation.operator", "." ],
|
||||
[ "identifier", "WriteLine" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "string", "\"Hello World\"" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+231
@@ -0,0 +1,231 @@
|
||||
[
|
||||
{
|
||||
"state": "ruleset",
|
||||
"data": [
|
||||
[ "variable", ".text-layer" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "font-family" ],
|
||||
[ "text", ": Monaco, " ],
|
||||
[ "string", "\"Courier New\"" ],
|
||||
[ "text", ", " ],
|
||||
[ "support.constant.fonts", "monospace" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "font-size" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "12" ],
|
||||
[ "keyword", "px" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "cursor" ],
|
||||
[ "text", ": " ],
|
||||
[ "support.constant", "text" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "ruleset",
|
||||
"data": [
|
||||
[ "variable", ".blinker" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "animation-duration" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "1" ],
|
||||
[ "keyword", "s" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "animation-name" ],
|
||||
[ "text", ": blink;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "animation-iteration-count" ],
|
||||
[ "text", ": infinite;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "animation-direction" ],
|
||||
[ "text", ": alternate;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "animation-timing-function" ],
|
||||
[ "text", ": " ],
|
||||
[ "support.constant", "linear" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "media",
|
||||
"data": [
|
||||
[ "string", "@keyframes blink {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media_ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "constant", "0" ],
|
||||
[ "text", "% " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media_ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "opacity" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media_ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "constant", "40" ],
|
||||
[ "text", "% " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media_ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "opacity" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media_ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "constant", "40" ],
|
||||
[ "variable", ".5" ],
|
||||
[ "text", "% " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media_ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "opacity" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "1" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media_ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "constant", "100" ],
|
||||
[ "text", "% " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media_ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "opacity" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "1" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "media",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "string", "}" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+732
@@ -0,0 +1,732 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "variable", "diff" ],
|
||||
[ "variable", " --git" ],
|
||||
[ "keyword", " a/lib/ace/edit_session.js" ],
|
||||
[ "variable", " b/lib/ace/edit_session.js" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "variable", "index 23fc3fc..ed3b273 100644" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant.numeric", "---" ],
|
||||
[ "meta.tag", " a/lib/ace/edit_session.js" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant.numeric", "+++" ],
|
||||
[ "meta.tag", " b/lib/ace/edit_session.js" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant", "@@" ],
|
||||
[ "constant.numeric", " -51,6 +51,7 " ],
|
||||
[ "constant", "@@" ],
|
||||
[ "comment.doc.tag", " var TextMode = require(\"./mode/text\").Mode;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " var Range = require(\"./range\").Range;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " var Document = require(\"./document\").Document;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " var BackgroundTokenizer = require(\"./background_tokenizer\").BackgroundTokenizer;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", "var SearchHighlight = require(\"./search_highlight\").SearchHighlight;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " /**" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " * class EditSession" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant", "@@" ],
|
||||
[ "constant.numeric", " -307,6 +308,13 " ],
|
||||
[ "constant", "@@" ],
|
||||
[ "comment.doc.tag", " var EditSession = function(text, mode) {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " return token;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " };" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", " this.highlight = function(re) {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", " if (!this.$searchHighlight) {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", " var highlight = new SearchHighlight(null, \"ace_selected-word\", \"text\");" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", " this.$searchHighlight = this.addDynamicMarker(highlight);" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", " }" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", " this.$searchHighlight.setRegexp(re);" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", " }" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " /**" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " * EditSession.setUndoManager(undoManager)" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " * - undoManager (UndoManager): The new undo manager" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant", "@@" ],
|
||||
[ "constant.numeric", " -556,7 +564,8 " ],
|
||||
[ "constant", "@@" ],
|
||||
[ "comment.doc.tag", " var EditSession = function(text, mode) {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " type : type || \"line\"," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " renderer: typeof type == \"function\" ? type : null," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " clazz : clazz," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.function", "-" ],
|
||||
[ "string", " inFront: !!inFront" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", " inFront: !!inFront," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", " id: id" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " }" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " if (inFront) {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "variable", "diff" ],
|
||||
[ "variable", " --git" ],
|
||||
[ "keyword", " a/lib/ace/editor.js" ],
|
||||
[ "variable", " b/lib/ace/editor.js" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "variable", "index 834e603..b27ec73 100644" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant.numeric", "---" ],
|
||||
[ "meta.tag", " a/lib/ace/editor.js" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant.numeric", "+++" ],
|
||||
[ "meta.tag", " b/lib/ace/editor.js" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant", "@@" ],
|
||||
[ "constant.numeric", " -494,7 +494,7 " ],
|
||||
[ "constant", "@@" ],
|
||||
[ "comment.doc.tag", " var Editor = function(renderer, session) {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " * Emitted when a selection has changed." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " **/" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " this.onSelectionChange = function(e) {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.function", "-" ],
|
||||
[ "string", " var session = this.getSession();" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", " var session = this.session;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " if (session.$selectionMarker) {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " session.removeMarker(session.$selectionMarker);" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant", "@@" ],
|
||||
[ "constant.numeric", " -509,12 +509,40 " ],
|
||||
[ "constant", "@@" ],
|
||||
[ "comment.doc.tag", " var Editor = function(renderer, session) {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " this.$updateHighlightActiveLine();" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " }" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.function", "-" ],
|
||||
[ "string", " var self = this;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.function", "-" ],
|
||||
[ "string", " if (this.$highlightSelectedWord && !this.$wordHighlightTimer)" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.function", "-" ],
|
||||
[ "string", " this.$wordHighlightTimer = setTimeout(function() {" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.function", "-" ],
|
||||
[ "string", " self.session.$mode.highlightSelection(self);" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.function", "-" ],
|
||||
[ "string", " self.$wordHighlightTimer = null;" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.function", "-" ],
|
||||
[ "string", " }, 30, this);" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", " var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", " };" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "variable", "diff" ],
|
||||
[ "variable", " --git" ],
|
||||
[ "keyword", " a/lib/ace/search_highlight.js" ],
|
||||
[ "variable", " b/lib/ace/search_highlight.js" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "invisible", "new file mode 100644" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "variable", "index 0000000..b2df779" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant.numeric", "---" ],
|
||||
[ "meta.tag", " /dev/null" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant.numeric", "+++" ],
|
||||
[ "meta.tag", " b/lib/ace/search_highlight.js" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "constant", "@@" ],
|
||||
[ "constant.numeric", " -0,0 +1,3 " ],
|
||||
[ "constant", "@@" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", "new" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.constant", "+" ],
|
||||
[ "text", "empty file" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "uniform" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "float" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "amplitude" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "attribute" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "float" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "displacement" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "varying" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "vec3" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "vNormal" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "void" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.name.function", "main" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "vNormal" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "normal" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "// multiply our displacement by the" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "// amplitude. The amp will get animated" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "// so we'll have animated displacement" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "vec3" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "newPosition" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "position" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "normal" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "*" ],
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "vec3" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "displacement" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "*" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "amplitude" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "constant.language", "gl_Position" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "projectionMatrix" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "*" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "modelViewMatrix" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "*" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "vec4" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "newPosition" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "constant.numeric", "1.0" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+362
@@ -0,0 +1,362 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "// Concurrent computation of pi." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "// See http://goo.gl/ZuTZM." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "//" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "// This demonstrates Go's ability to handle" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "// large numbers of concurrent processes." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "// It is an unreasonable way to calculate pi." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "package" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "main" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "import" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "string", "\"fmt\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "string", "\"math\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "func" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "main" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "fmt" ],
|
||||
[ "punctuation.operator", "." ],
|
||||
[ "identifier", "Println" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "pi" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.numeric", "5000" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "// pi launches n goroutines to compute an" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "// approximation of pi." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "func" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "pi" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "n" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "int" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "float64" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "ch" ],
|
||||
[ "text", " " ],
|
||||
[ "punctuation.operator", ":" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "make" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "keyword", "chan" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "float64" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "k" ],
|
||||
[ "text", " " ],
|
||||
[ "punctuation.operator", ":" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "punctuation.operator", ";" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "k" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "<=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "n" ],
|
||||
[ "punctuation.operator", ";" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "k" ],
|
||||
[ "keyword.operator", "++" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "go" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "term" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "ch" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "float64" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "k" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "f" ],
|
||||
[ "text", " " ],
|
||||
[ "punctuation.operator", ":" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "0.0" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "k" ],
|
||||
[ "text", " " ],
|
||||
[ "punctuation.operator", ":" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "punctuation.operator", ";" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "k" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "<=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "n" ],
|
||||
[ "punctuation.operator", ";" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "k" ],
|
||||
[ "keyword.operator", "++" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "f" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "<" ],
|
||||
[ "keyword.operator", "-" ],
|
||||
[ "identifier", "ch" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "return" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "f" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "func" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "term" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "ch" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "chan" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "float64" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "k" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "float64" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "ch" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "<" ],
|
||||
[ "keyword.operator", "-" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "4" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "*" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "math" ],
|
||||
[ "punctuation.operator", "." ],
|
||||
[ "identifier", "Pow" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.numeric", "-1" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "k" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " / " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.numeric", "2" ],
|
||||
[ "keyword.operator", "*" ],
|
||||
[ "identifier", "k" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "1" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
}
|
||||
]
|
||||
+529
@@ -0,0 +1,529 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "//http://groovy.codehaus.org/Martin+Fowler%27s+closure+examples+in+Groovy" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "class" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "Employee" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "def" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "name" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "salary" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "boolean" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "manager" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.function", "String" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "toString" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "return" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "name" ],
|
||||
[ "text", " " ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "def" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "[" ],
|
||||
[ "keyword", "new" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "Employee" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "name" ],
|
||||
[ "text", ":" ],
|
||||
[ "string", "'Guillaume'" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "manager" ],
|
||||
[ "text", ":" ],
|
||||
[ "constant.language.boolean", "true" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "salary" ],
|
||||
[ "text", ":" ],
|
||||
[ "constant.numeric", "200" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "new" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "Employee" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "name" ],
|
||||
[ "text", ":" ],
|
||||
[ "string", "'Graeme'" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "manager" ],
|
||||
[ "text", ":" ],
|
||||
[ "constant.language.boolean", "true" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "salary" ],
|
||||
[ "text", ":" ],
|
||||
[ "constant.numeric", "200" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "new" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "Employee" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "name" ],
|
||||
[ "text", ":" ],
|
||||
[ "string", "'Dierk'" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "manager" ],
|
||||
[ "text", ":" ],
|
||||
[ "constant.language.boolean", "false" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "salary" ],
|
||||
[ "text", ":" ],
|
||||
[ "constant.numeric", "151" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "new" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "Employee" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "name" ],
|
||||
[ "text", ":" ],
|
||||
[ "string", "'Bernd'" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "manager" ],
|
||||
[ "text", ":" ],
|
||||
[ "constant.language.boolean", "false" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "salary" ],
|
||||
[ "text", ":" ],
|
||||
[ "constant.numeric", "50" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "rparen", "]" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "def" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "managers" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "findAll" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "e" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "-" ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "e" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "isManager" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "assert" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "lparen", "[" ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", ".." ],
|
||||
[ "constant.numeric", "1" ],
|
||||
[ "rparen", "]" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "==" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "managers" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "// [Guillaume, Graeme]" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "def" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "highPaid" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "threshold" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "150" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "findAll" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "e" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "-" ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "e" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "salary" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "threshold" ],
|
||||
[ "text", " " ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "assert" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "lparen", "[" ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", ".." ],
|
||||
[ "constant.numeric", "2" ],
|
||||
[ "rparen", "]" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "==" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "highPaid" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "// [Guillaume, Graeme, Dierk]" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "def" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "paidMore" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "amount" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "e" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "-" ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "e" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "salary" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "amount" ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "def" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "highPaid" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "paidMore" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "constant.numeric", "150" ],
|
||||
[ "rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "assert" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "highPaid" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "lparen", "[" ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "rparen", "]" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "// true" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "assert" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "lparen", "[" ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", ".." ],
|
||||
[ "constant.numeric", "2" ],
|
||||
[ "rparen", "]" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "==" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "emps" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "findAll" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "highPaid" ],
|
||||
[ "rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "def" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "filename" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "'test.txt'" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "new" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "File" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "filename" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "withReader" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "reader" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "-" ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "doSomethingWith" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "reader" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "def" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "readersText" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "def" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "doSomethingWith" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "reader" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "readersText" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "reader" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "text" ],
|
||||
[ "text", " " ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "assert" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "new" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "File" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "filename" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "text" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "==" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "readersText" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+195
@@ -0,0 +1,195 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "class" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "Haxe" ],
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "public" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "static" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "function" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "main" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "// Say Hello!" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "var" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "greeting" ],
|
||||
[ "punctuation.operator", ":" ],
|
||||
[ "keyword", "String" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"Hello World\"" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "trace" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "greeting" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "var" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "targets" ],
|
||||
[ "punctuation.operator", ":" ],
|
||||
[ "keyword", "Array" ],
|
||||
[ "keyword.operator", "<" ],
|
||||
[ "keyword", "String" ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "[" ],
|
||||
[ "string", "\"Flash\"" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "string", "\"Javascript\"" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "string", "\"PHP\"" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "string", "\"Neko\"" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "string", "\"C++\"" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "string", "\"iOS\"" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "string", "\"Android\"" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "string", "\"webOS\"" ],
|
||||
[ "paren.rparen", "]" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "trace" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "string", "\"Haxe is a great language that can target:\"" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "target" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "in" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "targets" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "trace" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "string", "\" - \"" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "target" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "trace" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "string", "\"And many more!\"" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "html" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "head" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "css-start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.style", "style" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "type" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"text/css\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "css-ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", ".text-layer" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "css-ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "font-family" ],
|
||||
[ "text", ": Monaco, " ],
|
||||
[ "string", "\"Courier New\"" ],
|
||||
[ "text", ", " ],
|
||||
[ "support.constant.fonts", "monospace" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "css-ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "font-size" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "12" ],
|
||||
[ "keyword", "px" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "css-ruleset",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "cursor" ],
|
||||
[ "text", ": " ],
|
||||
[ "support.constant", "text" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "css-start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.style", "style" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "head" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "body" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "h1" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "style" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"color:red\"" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "Juhu Kinners" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "h1" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "body" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "html" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "public" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "class" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "InfiniteLoop" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "/*" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "comment", " * This will cause the program to hang..." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "comment", " *" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "comment", " * Taken from:" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "comment", " * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", " */" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "public" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "static" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "void" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "main" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "support.function", "String" ],
|
||||
[ "lparen", "[" ],
|
||||
[ "rparen", "]" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "args" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "double" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "d" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "Double" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "parseDouble" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "string", "\"2.2250738585072012e-308\"" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "// unreachable code" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.function", "System" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "out" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "println" ],
|
||||
[ "lparen", "(" ],
|
||||
[ "string", "\"Value: \"" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "d" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+555
@@ -0,0 +1,555 @@
|
||||
[
|
||||
{
|
||||
"state": "regex_allowed",
|
||||
"data": [
|
||||
[ "storage.type", "function" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.name.function", "foo" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable.parameter", "items" ],
|
||||
[ "punctuation.operator", ", " ],
|
||||
[ "variable.parameter", "nada" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "regex_allowed",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "storage.type", "var" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "i" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "punctuation.operator", ";" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "i" ],
|
||||
[ "keyword.operator", "<" ],
|
||||
[ "identifier", "items" ],
|
||||
[ "punctuation.operator", "." ],
|
||||
[ "support.constant", "length" ],
|
||||
[ "punctuation.operator", ";" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "i" ],
|
||||
[ "keyword.operator", "++" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "regex_allowed",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "alert" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "items" ],
|
||||
[ "paren.lparen", "[" ],
|
||||
[ "identifier", "i" ],
|
||||
[ "paren.rparen", "]" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"juhu" ],
|
||||
[ "constant.language.escape", "\\n" ],
|
||||
[ "string", "\"" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ],
|
||||
[ "text", "\t" ],
|
||||
[ "comment", "// Real Tab." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "identifier", "regexp" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "string.regexp", "/p" ],
|
||||
[ "constant.language.escape", "|" ],
|
||||
[ "string.regexp", "p/" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "// ends here" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "identifier", "r" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "string.regexp", "/d" ],
|
||||
[ "constant.language.escape", "{1,2}" ],
|
||||
[ "constant.language.escape", "?" ],
|
||||
[ "string.regexp", "f{e}" ],
|
||||
[ "invalid", "++" ],
|
||||
[ "string.regexp", "r" ],
|
||||
[ "constant.language.escape", "*?" ],
|
||||
[ "regexp.keyword.operator", "\\d" ],
|
||||
[ "constant.language.escape", "+?[]" ],
|
||||
[ "string.regexp", "r" ],
|
||||
[ "constant.language.escape", "[^" ],
|
||||
[ "string.regexp.charachterclass", "r" ],
|
||||
[ "constant.language.escape", "-" ],
|
||||
[ "string.regexp.charachterclass", "o" ],
|
||||
[ "regexp.keyword.operator", "\\f" ],
|
||||
[ "regexp.keyword.operator", "\\f" ],
|
||||
[ "string.regexp.charachterclass", "[" ],
|
||||
[ "regexp.keyword.operator", "\\f" ],
|
||||
[ "constant.language.escape", "]" ],
|
||||
[ "constant.language.escape", "?" ],
|
||||
[ "string.regexp", "r" ],
|
||||
[ "invalid", "{7}+" ],
|
||||
[ "string.regexp", "r" ],
|
||||
[ "regexp.keyword.operator", "\\{" ],
|
||||
[ "string.regexp", "7}" ],
|
||||
[ "constant.language.escape", "+" ],
|
||||
[ "string.regexp", "rr--rr" ],
|
||||
[ "constant.language.escape", "$" ],
|
||||
[ "constant.language.escape", "^" ],
|
||||
[ "constant.language.escape", "(?:" ],
|
||||
[ "string.regexp", "d" ],
|
||||
[ "constant.language.escape", "|" ],
|
||||
[ "string.regexp", "s" ],
|
||||
[ "constant.language.escape", ")" ],
|
||||
[ "constant.language.escape", "(?=" ],
|
||||
[ "string.regexp", "a" ],
|
||||
[ "constant.language.escape", "|" ],
|
||||
[ "constant.language.escape", ")" ],
|
||||
[ "constant.language.escape", "(?!" ],
|
||||
[ "string.regexp", "y" ],
|
||||
[ "constant.language.escape", ")[]" ],
|
||||
[ "constant.language.escape", "|" ],
|
||||
[ "constant.language.escape", "$" ],
|
||||
[ "constant.language.escape", "?" ],
|
||||
[ "constant.language.escape", "|" ],
|
||||
[ "invalid", "^*" ],
|
||||
[ "string.regexp", "/" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "o" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "identifier", "a" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string.regexp", "/a/" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "jk" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "string.regexp", "/ /" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "/" ],
|
||||
[ "text", " " ],
|
||||
[ "string.regexp", "/ /" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment.doc", "/************************************/" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment.doc", "/** total mess, tricky to highlight**/" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "regex_allowed",
|
||||
"data": [
|
||||
[ "storage.type", "function" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "doc-start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "comment.doc", "/**" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "doc-start",
|
||||
"data": [
|
||||
[ "comment.doc", "\t * docComment" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment.doc", "\t **/" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "identifier", "r" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "string.regexp", "/u" ],
|
||||
[ "regexp.keyword.operator", "\\t" ],
|
||||
[ "constant.language.escape", "*" ],
|
||||
[ "string.regexp", "/" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "identifier", "g" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "1." ],
|
||||
[ "text", "00" ],
|
||||
[ "identifier", "E" ],
|
||||
[ "text", "^" ],
|
||||
[ "constant.numeric", "1" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "y" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "1.2" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "punctuation.operator", "." ],
|
||||
[ "constant.numeric", "2" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "052" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "0x25" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "identifier", "t" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "[" ],
|
||||
[ "string", "'d'" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "text", " " ],
|
||||
[ "string", "''" ],
|
||||
[ "paren.rparen", "]" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "regex_allowed",
|
||||
"data": [
|
||||
[ "storage.type", "function" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "regex_allowed",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "comment", "/* eee */" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "qqstring",
|
||||
"data": [
|
||||
[ "string", "\"s\\" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "string", "s" ],
|
||||
[ "constant.language.escape", "\\u7824" ],
|
||||
[ "string", "sss" ],
|
||||
[ "constant.language.escape", "\\u" ],
|
||||
[ "string", "1\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "qstring",
|
||||
"data": [
|
||||
[ "string", "'\\" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "string", "string'" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "'" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "identifier", "string" ],
|
||||
[ "text", "'" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "string", "\"trailing space" ],
|
||||
[ "constant.language.escape", "\\ " ],
|
||||
[ "string", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "string", "\" \"" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "/" ],
|
||||
[ "identifier", "not" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "a" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "regexp" ],
|
||||
[ "keyword.operator", "/" ],
|
||||
[ "identifier", "g" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "doc-start",
|
||||
"data": [
|
||||
[ "comment.doc", "/**" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "doc-start",
|
||||
"data": [
|
||||
[ "comment.doc", " *doc" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment.doc", " */" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "regex_allowed",
|
||||
"data": [
|
||||
[ "identifier", "a" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "regex_allowed",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "string", "'a'" ],
|
||||
[ "punctuation.operator", ":" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "b" ],
|
||||
[ "punctuation.operator", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "string", "'g'" ],
|
||||
[ "text", ": " ],
|
||||
[ "storage.type", "function" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable.parameter", "t" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "entity.name.function", "gta" ],
|
||||
[ "punctuation.operator", ":" ],
|
||||
[ "storage.type", "function" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable.parameter", "a" ],
|
||||
[ "punctuation.operator", "," ],
|
||||
[ "variable.parameter", "b" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "function_arguments",
|
||||
"data": [
|
||||
[ "identifier", "foo" ],
|
||||
[ "punctuation.operator", "." ],
|
||||
[ "storage.type", "protoype" ],
|
||||
[ "punctuation.operator", "." ],
|
||||
[ "entity.name.function", "d" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "storage.type", "function" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable.parameter", "a" ],
|
||||
[ "punctuation.operator", ", " ],
|
||||
[ "variable.parameter", "b" ],
|
||||
[ "punctuation.operator", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "punctuation.operator", " " ],
|
||||
[ "variable.parameter", "c" ],
|
||||
[ "punctuation.operator", ", " ],
|
||||
[ "variable.parameter", "d" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "storage.type", "foo" ],
|
||||
[ "punctuation.operator", "." ],
|
||||
[ "entity.name.function", "d" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "storage.type", "function" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable.parameter", "a" ],
|
||||
[ "punctuation.operator", ", " ],
|
||||
[ "variable.parameter", "b" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "storage.type", "foo" ],
|
||||
[ "punctuation.operator", "." ],
|
||||
[ "entity.name.function", "d" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "storage.type", "function" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable.parameter", "a" ],
|
||||
[ "punctuation.operator", ", " ],
|
||||
[ "comment.doc", "/*****/" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "d" ],
|
||||
[ "string", "\"string\"" ],
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
}
|
||||
]
|
||||
+611
@@ -0,0 +1,611 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"query\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"count\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "10" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"created\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"2011-06-21T08:10:46Z\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"lang\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"en-US\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"results\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"photo\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "paren.lparen", "[" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"farm\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"6\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"id\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"5855620975\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"isfamily\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"0\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"isfriend\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"0\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"ispublic\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"1\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"owner\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"32021554@N04\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"secret\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"f1f5e8515d\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"server\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"5110\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"title\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"7087 bandit cat\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"farm\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"4\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"id\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"5856170534\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"isfamily\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"0\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"isfriend\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"0\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"ispublic\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"1\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"owner\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"32021554@N04\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"secret\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"ff1efb2a6f\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"server\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"3217\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"title\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"6975 rusty cat\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"farm\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"6\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"id\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"5856172972\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"isfamily\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"0\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"isfriend\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"0\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"ispublic\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"1\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"owner\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"51249875@N03\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"secret\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"6c6887347c\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"server\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"5192\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"title\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"watermarked-cats\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"farm\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"6\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"id\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"5856168328\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"isfamily\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"0\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"isfriend\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"0\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"ispublic\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"1\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"owner\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"32021554@N04\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"secret\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"0c1cfdf64c\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"server\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"5078\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"title\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"7020 mandy cat\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"farm\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"3\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"id\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"5856171774\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"isfamily\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"0\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"isfriend\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"0\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"ispublic\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"1\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"owner\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"32021554@N04\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"secret\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"7f5a3180ab\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"server\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"2696\"" ],
|
||||
[ "text", "," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "\"title\"" ],
|
||||
[ "text", ": " ],
|
||||
[ "string", "\"7448 bobby cat\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "]" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
[
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "comment", "/*EXPECTED" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "comment", "hello world!" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "*/" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "class" ],
|
||||
[ "text", " " ],
|
||||
[ "language.support.class", "Test" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "static" ],
|
||||
[ "text", " " ],
|
||||
[ "storage.type", "function" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.name.function", "run" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "punctuation.operator", ":" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "void" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "// console.log(\"hello world!\");" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "log" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"hello world!\"" ],
|
||||
[ "punctuation.operator", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "\\usepackage" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", "amsmath" ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "\\title" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "keyword", "\\LaTeX" ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "\\date" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "\\begin" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", "document" ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "\\maketitle" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "\\LaTeX" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "rparen", "}" ],
|
||||
[ "text", " is a document preparation system for the " ],
|
||||
[ "keyword", "\\TeX" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " typesetting program. It offers programmable desktop publishing" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " features and extensive facilities for automating most aspects of" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " typesetting and desktop publishing, including numbering and" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " cross-referencing, tables and figures, page layout, bibliographies," ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " and much more. " ],
|
||||
[ "keyword", "\\LaTeX" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "rparen", "}" ],
|
||||
[ "text", " was originally written in 1984 by Leslie" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " Lamport and has become the dominant method for using " ],
|
||||
[ "keyword", "\\TeX" ],
|
||||
[ "text", "; few" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " people write in plain " ],
|
||||
[ "keyword", "\\TeX" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "rparen", "}" ],
|
||||
[ "text", " anymore. The current version is" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "\\LaTeXe" ],
|
||||
[ "text", "." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "% This is a comment; it will not be shown in the final output." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "% The following shows a little of the typesetting power of LaTeX:" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "\\begin" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", "align" ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " E &= mc^2 " ],
|
||||
[ "keyword", "\\\\" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " m &= " ],
|
||||
[ "keyword", "\\frac" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", "m_0" ],
|
||||
[ "rparen", "}" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "keyword", "\\sqrt" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", "1-" ],
|
||||
[ "keyword", "\\frac" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", "v^2" ],
|
||||
[ "rparen", "}" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", "c^2" ],
|
||||
[ "rparen", "}" ],
|
||||
[ "rparen", "}" ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "\\end" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", "align" ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "\\end" ],
|
||||
[ "lparen", "{" ],
|
||||
[ "text", "document" ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+292
@@ -0,0 +1,292 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "/*" ],
|
||||
[ "comment", " styles.less */" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "variable", "@base" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "#f938ab" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "variable.language", ".box-shadow" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable", "@style" ],
|
||||
[ "text", ", " ],
|
||||
[ "variable", "@c" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "when" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "support.function", "iscolor" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable", "@c" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " box-shadow: " ],
|
||||
[ "variable", "@style" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "@c" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " -webkit-box-shadow: " ],
|
||||
[ "variable", "@style" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "@c" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " -moz-box-shadow: " ],
|
||||
[ "variable", "@style" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "@c" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "variable.language", ".box-shadow" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable", "@style" ],
|
||||
[ "text", ", " ],
|
||||
[ "variable", "@alpha" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "50%" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "when" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "support.function", "isnumber" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable", "@alpha" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable.language", ".box-shadow" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable", "@style" ],
|
||||
[ "text", ", " ],
|
||||
[ "support.function", "rgba" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", ", " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", ", " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", ", " ],
|
||||
[ "variable", "@alpha" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "// Box styles" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "variable.language", ".box" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ],
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "color" ],
|
||||
[ "text", ": " ],
|
||||
[ "support.function", "saturate" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable", "@base" ],
|
||||
[ "text", ", " ],
|
||||
[ "constant.numeric", "5%" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "border-color" ],
|
||||
[ "text", ": " ],
|
||||
[ "support.function", "lighten" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable", "@base" ],
|
||||
[ "text", ", " ],
|
||||
[ "constant.numeric", "30%" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable.language", "div" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ],
|
||||
[ "text", " " ],
|
||||
[ "variable.language", ".box-shadow" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "5px" ],
|
||||
[ "text", ", " ],
|
||||
[ "constant.numeric", "30%" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable.language", "a" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "color" ],
|
||||
[ "text", ": " ],
|
||||
[ "variable", "@base" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " &" ],
|
||||
[ "variable.language", ":hover" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.type", "color" ],
|
||||
[ "text", ": " ],
|
||||
[ "support.function", "lighten" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "variable", "@base" ],
|
||||
[ "text", ", " ],
|
||||
[ "constant.numeric", "50%" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "paren.rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
}
|
||||
]
|
||||
+698
@@ -0,0 +1,698 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "The following examples can be found in full at http://liquidmarkup.org/" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "Liquid is an extraction from the e-commerce system Shopify." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "Shopify powers many thousands of e-commerce stores which all call for unique designs." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "For this we developed Liquid which allows our customers complete design freedom while" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "maintaining the integrity of our servers." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "Liquid has been in production use since June 2006 and is now used by many other" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "hosted web applications." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "It was developed for usage in Ruby on Rails web applications and integrates seamlessly" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "as a plugin but it also works excellently as a stand alone library." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "Here's what it looks like:" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "ul" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "id" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"products\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "product" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "in" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "products" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "li" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "variable", "{{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "product" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "title" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "}}" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " Only {{ product.price | format_as_money }}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "variable", "{{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "product" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "description" ],
|
||||
[ "text", " | " ],
|
||||
[ "identifier", "prettyprint" ],
|
||||
[ "text", " | " ],
|
||||
[ "support.function", "truncate" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "200" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "}}" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "li" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "endfor" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "ul" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "Some more features include:" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "Filters" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", " The word \"tobi\" in uppercase: {{ 'tobi' | upcase }} " ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "The word \"tobi\" has {{ 'tobi' | size }} letters! " ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "Change \"Hello world\" to \"Hi world\": {{ 'Hello world' | replace: 'Hello', 'Hi' }} " ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "The date today is {{ 'now' | date: \"%Y %b %d\" }} " ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "If" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "if" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "user" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "name" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "'tobi'" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "or" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "user" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "name" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "'marc'" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ],
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " hi marc or tobi" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "endif" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "Case" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "case" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "template" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "when" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "'index'" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " Welcome" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "when" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "'product'" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "product" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "vendor" ],
|
||||
[ "text", " | " ],
|
||||
[ "identifier", "link_to_vendor" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "}}" ],
|
||||
[ "text", " / {{ product.title }}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "else" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "page_title" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "}}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "endcase" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "For Loops" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "item" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "in" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "array" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ],
|
||||
[ "text", " " ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "item" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "}}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "endfor" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "Tables" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "tablerow" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "item" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "in" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "items" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "cols" ],
|
||||
[ "text", ": " ],
|
||||
[ "constant.numeric", "3" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "if" ],
|
||||
[ "text", " " ],
|
||||
[ "variable.language", "tablerowloop" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "col_first" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " First column: {{ item.variable }}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "else" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " Different column: {{ item.variable }}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "endif" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "variable", "{%" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "endtablerow" ],
|
||||
[ "text", " " ],
|
||||
[ "variable", "%}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
}
|
||||
]
|
||||
+451
@@ -0,0 +1,451 @@
|
||||
[
|
||||
{
|
||||
"state": "qcomment",
|
||||
"data": [
|
||||
[ "comment", "--[[--" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "qcomment",
|
||||
"data": [
|
||||
[ "comment", "num_args takes in 5.1 byte code and extracts the number of arguments" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "qcomment",
|
||||
"data": [
|
||||
[ "comment", "from its function header." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "--]]" ],
|
||||
[ "comment", "--" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "function" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "int" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "t" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "keyword", "return" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "t" ],
|
||||
[ "keyword.operator", ":" ],
|
||||
[ "support.function", "byte" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.numeric", "1" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "identifier", "t" ],
|
||||
[ "keyword.operator", ":" ],
|
||||
[ "support.function", "byte" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.numeric", "2" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "keyword.operator", "*" ],
|
||||
[ "constant.numeric", "0x100" ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "identifier", "t" ],
|
||||
[ "keyword.operator", ":" ],
|
||||
[ "support.function", "byte" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.numeric", "3" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "keyword.operator", "*" ],
|
||||
[ "constant.numeric", "0x10000" ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "identifier", "t" ],
|
||||
[ "keyword.operator", ":" ],
|
||||
[ "support.function", "byte" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.numeric", "4" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "keyword.operator", "*" ],
|
||||
[ "constant.numeric", "0x1000000" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "end" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "function" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "num_args" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "func" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "keyword", "local" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "dump" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.library", "string" ],
|
||||
[ "text", "." ],
|
||||
[ "support.function", "dump" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "func" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "keyword", "local" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "offset" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "cursor" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "int" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "support.function", "dump" ],
|
||||
[ "keyword.operator", ":" ],
|
||||
[ "support.function", "sub" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.numeric", "13" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "offset" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "26" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "comment", "--Get the params and var flag (whether there's a ... in the param)" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "keyword", "return" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "dump" ],
|
||||
[ "keyword.operator", ":" ],
|
||||
[ "support.function", "sub" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "cursor" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "keyword.operator", ":" ],
|
||||
[ "support.function", "byte" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", ", " ],
|
||||
[ "support.function", "dump" ],
|
||||
[ "keyword.operator", ":" ],
|
||||
[ "support.function", "sub" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "cursor" ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "constant.numeric", "1" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "keyword.operator", ":" ],
|
||||
[ "support.function", "byte" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "end" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "-- Usage:" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "identifier", "num_args" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "keyword", "function" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "a" ],
|
||||
[ "text", "," ],
|
||||
[ "identifier", "b" ],
|
||||
[ "text", "," ],
|
||||
[ "identifier", "c" ],
|
||||
[ "text", "," ],
|
||||
[ "identifier", "d" ],
|
||||
[ "text", ", " ],
|
||||
[ "keyword.operator", "..." ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "end" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "-- return 4, 7" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "-- Python styled string format operator" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "local" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "gm" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.library", "debug" ],
|
||||
[ "text", "." ],
|
||||
[ "support.function", "getmetatable" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "string", "\"\"" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "identifier", "gm" ],
|
||||
[ "text", "." ],
|
||||
[ "support.function", "__mod" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "keyword", "function" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "self" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "other" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "if" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "type" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "other" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "~" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"table\"" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "then" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "other" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ],
|
||||
[ "identifier", "other" ],
|
||||
[ "paren.rparen", "}" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "end" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "i" ],
|
||||
[ "text", "," ],
|
||||
[ "identifier", "v" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "in" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "ipairs" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "other" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "do" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "other" ],
|
||||
[ "paren.lparen", "[" ],
|
||||
[ "identifier", "i" ],
|
||||
[ "paren.rparen", "]" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "tostring" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "v" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "end" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "return" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "self" ],
|
||||
[ "keyword.operator", ":" ],
|
||||
[ "support.function", "format" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "support.function", "unpack" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "other" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "end" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "qstring3",
|
||||
"data": [
|
||||
[ "support.function", "print" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "string", "[===[" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "qstring3",
|
||||
"data": [
|
||||
[ "string", " blah blah %s, (%d %d)" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "string", "]===]" ],
|
||||
[ "keyword.operator", "%" ],
|
||||
[ "paren.lparen", "{" ],
|
||||
[ "string", "\"blah\"" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "num_args" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "int" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "paren.rparen", "}" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "qcomment1",
|
||||
"data": [
|
||||
[ "comment", "--[=[--" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "qcomment1",
|
||||
"data": [
|
||||
[ "comment", "table.maxn is deprecated, use # instead." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "--]=]" ],
|
||||
[ "comment", "--" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.function", "print" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "constant.library", "table" ],
|
||||
[ "text", "." ],
|
||||
[ "invalid.deprecated", "maxn" ],
|
||||
[ "paren.lparen", "{" ],
|
||||
[ "constant.numeric", "1" ],
|
||||
[ "text", "," ],
|
||||
[ "constant.numeric", "2" ],
|
||||
[ "text", "," ],
|
||||
[ "paren.lparen", "[" ],
|
||||
[ "constant.numeric", "4" ],
|
||||
[ "paren.rparen", "]" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "constant.numeric", "4" ],
|
||||
[ "text", "," ],
|
||||
[ "paren.lparen", "[" ],
|
||||
[ "constant.numeric", "8" ],
|
||||
[ "paren.rparen", "]" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "constant.numeric", "8" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "-- outputs 8 instead of 2" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
}
|
||||
]
|
||||
+824
@@ -0,0 +1,824 @@
|
||||
[
|
||||
{
|
||||
"state": "tag_embed_attribute_list",
|
||||
"data": [
|
||||
[ "text", "" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "text", "!" ],
|
||||
[ "entity.other.attribute-name", "DOCTYPE" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "html" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "PUBLIC" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"-//W3C//DTD XHTML 1.0 Strict//EN\"" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "string", "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "html" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "lua-qcomment",
|
||||
"data": [
|
||||
[ "keyword", "<%" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "--[[--" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "lua-qcomment",
|
||||
"data": [
|
||||
[ "comment", " index.lp from the Kepler Project's LuaDoc HTML doclet." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "lua-qcomment",
|
||||
"data": [
|
||||
[ "comment", " http://keplerproject.github.com/luadoc/" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "--]]" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "%>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "head" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "title" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "Reference" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "title" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "link" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "rel" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"stylesheet\"" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "href" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"<%=luadoc.doclet.html.link(\"" ],
|
||||
[ "entity.other.attribute-name", "luadoc" ],
|
||||
[ "text", "." ],
|
||||
[ "entity.other.attribute-name", "css" ],
|
||||
[ "string", "\")%>\"" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "type" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"text/css\"" ],
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "/>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "comment", "<!--" ],
|
||||
[ "comment", "meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/-->" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "head" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "body" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "id" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"container\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "id" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"product\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "id" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"product_logo\"" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "id" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"product_name\"" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "big" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "b" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "b" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "big" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "id" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"product_description\"" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "<!--" ],
|
||||
[ "comment", " id=\"product\" -->" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "id" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"main\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "id" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"navigation\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "<%=" ],
|
||||
[ "identifier", "luadoc" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "doclet" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "html" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "include" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "string", "\"menu.lp\"" ],
|
||||
[ "text", ", " ],
|
||||
[ "paren.lparen", "{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "doc" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "identifier", "doc" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.rparen", "}" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "keyword", "%>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "<!--" ],
|
||||
[ "comment", " id=\"navigation\" -->" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "id" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"content\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "<%" ],
|
||||
[ "keyword", "if" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "not" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "options" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "nomodules" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "and" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "#" ],
|
||||
[ "identifier", "doc" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "modules" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "then" ],
|
||||
[ "keyword", "%>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "Modules" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.table", "table" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "class" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"module_list\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "<!--" ],
|
||||
[ "comment", "<tr><td colspan=\"2\">Modules</td></tr>-->" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "<%" ],
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "_" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "modulename" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "in" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "ipairs" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "doc" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "modules" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "do" ],
|
||||
[ "keyword", "%>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.table", "tr" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t\t" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.table", "td" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "class" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"name\"" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.anchor", "a" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "href" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"<%=luadoc.doclet.html.module_link(modulename, doc)%>\"" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "keyword", "<%=" ],
|
||||
[ "identifier", "modulename" ],
|
||||
[ "keyword", "%>" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.anchor", "a" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.table", "td" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t\t" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.table", "td" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "class" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"summary\"" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "keyword", "<%=" ],
|
||||
[ "identifier", "doc" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "modules" ],
|
||||
[ "paren.lparen", "[" ],
|
||||
[ "identifier", "modulename" ],
|
||||
[ "paren.rparen", "]" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "summary" ],
|
||||
[ "keyword", "%>" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.table", "td" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.table", "tr" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "<%" ],
|
||||
[ "keyword", "end" ],
|
||||
[ "keyword", "%>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.table", "table" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "<%" ],
|
||||
[ "keyword", "end" ],
|
||||
[ "keyword", "%>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "<%" ],
|
||||
[ "keyword", "if" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "not" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "options" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "nofiles" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "and" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "#" ],
|
||||
[ "identifier", "doc" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "files" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "then" ],
|
||||
[ "keyword", "%>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", "Files" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "h2" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.table", "table" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "class" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"file_list\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "<!--" ],
|
||||
[ "comment", "<tr><td colspan=\"2\">Files</td></tr>-->" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "<%" ],
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "_" ],
|
||||
[ "text", ", " ],
|
||||
[ "identifier", "filepath" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "in" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "ipairs" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "doc" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "files" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "do" ],
|
||||
[ "keyword", "%>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.table", "tr" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t\t" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.table", "td" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "class" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"name\"" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.anchor", "a" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "href" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"<%=luadoc.doclet.html.file_link(filepath)%>\"" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "keyword", "<%=" ],
|
||||
[ "identifier", "filepath" ],
|
||||
[ "keyword", "%>" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.anchor", "a" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.table", "td" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t\t" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.table", "td" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "class" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"summary\"" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.table", "td" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.table", "tr" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "<%" ],
|
||||
[ "keyword", "end" ],
|
||||
[ "keyword", "%>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.table", "table" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "<%" ],
|
||||
[ "keyword", "end" ],
|
||||
[ "keyword", "%>" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "<!--" ],
|
||||
[ "comment", " id=\"content\" -->" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "<!--" ],
|
||||
[ "comment", " id=\"main\" -->" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "id" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"about\"" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", "\t" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.anchor", "a" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "href" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"http://validator.w3.org/check?uri=referer\"" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "<" ],
|
||||
[ "meta.tag.tag-name.image", "img" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "src" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"http://www.w3.org/Icons/valid-xhtml10\"" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "alt" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"Valid XHTML 1.0!\"" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "height" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"31\"" ],
|
||||
[ "text", " " ],
|
||||
[ "entity.other.attribute-name", "width" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "string", "\"88\"" ],
|
||||
[ "text", " " ],
|
||||
[ "meta.tag", "/>" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name.anchor", "a" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "p" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "<!--" ],
|
||||
[ "comment", " id=\"about\" -->" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "div" ],
|
||||
[ "meta.tag", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "comment", "<!--" ],
|
||||
[ "comment", " id=\"container\" -->" ],
|
||||
[ "text", "\t" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "body" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "meta.tag", "</" ],
|
||||
[ "meta.tag.tag-name", "html" ],
|
||||
[ "meta.tag", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
}
|
||||
]
|
||||
+1202
File diff suppressed because it is too large
Load Diff
+260
@@ -0,0 +1,260 @@
|
||||
[
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "comment", "(*" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "comment", " * Example of early return implementation taken from" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "comment",
|
||||
"data": [
|
||||
[ "comment", " * http://ocaml.janestreet.com/?q=node/91" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", " *)" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "let" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "with_return" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "keyword", "type" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "t" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "f" ],
|
||||
[ "text", " : " ],
|
||||
[ "identifier", "_" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "-" ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "t" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "let" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "module" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "M" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "struct" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "exception" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "Return" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "of" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "t" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "end" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "in" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "let" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "return" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "{" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "return" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "keyword", "fun" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "x" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "-" ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "raise" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "identifier", "M" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "Return" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "x" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "text", "; " ],
|
||||
[ "paren.rparen", "}" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "in" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "try" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "f" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "return" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "with" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "M" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "Return" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "x" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "-" ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "x" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "(* Function that uses the 'early return' functionality provided by `with_return` *)" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "let" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "sum_until_first_negative" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "list" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "with_return" ],
|
||||
[ "text", " " ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "keyword", "fun" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "r" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "-" ],
|
||||
[ "keyword.operator", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.function", "List" ],
|
||||
[ "text", "." ],
|
||||
[ "support.function", "fold" ],
|
||||
[ "text", " " ],
|
||||
[ "support.function", "list" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "~" ],
|
||||
[ "support.function", "init" ],
|
||||
[ "text", ":" ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "~" ],
|
||||
[ "identifier", "f" ],
|
||||
[ "text", ":" ],
|
||||
[ "paren.lparen", "(" ],
|
||||
[ "keyword", "fun" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "acc" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "x" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "-" ],
|
||||
[ "keyword.operator", ">" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "if" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "x" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", ">" ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "then" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "acc" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "+" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "x" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "else" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "r" ],
|
||||
[ "text", "." ],
|
||||
[ "identifier", "return" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "acc" ],
|
||||
[ "paren.rparen", ")" ],
|
||||
[ "paren.rparen", ")" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
+311
@@ -0,0 +1,311 @@
|
||||
[
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "#!/usr/bin/perl" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "use" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "strict" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "use" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "warnings" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "my" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "$num_primes" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "my" ],
|
||||
[ "text", " @" ],
|
||||
[ "identifier", "primes" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "comment", "# Put 2 as the first prime so we won't have an empty array" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "identifier", "$primes" ],
|
||||
[ "lparen", "[" ],
|
||||
[ "identifier", "$num_primes" ],
|
||||
[ "rparen", "]" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "2" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "identifier", "$num_primes" ],
|
||||
[ "keyword.operator", "++" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "identifier", "MAIN_LOOP" ],
|
||||
[ "text", ":" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "my" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "$number_to_check" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "(" ],
|
||||
[ "constant.numeric", "3" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", ".." ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "200" ],
|
||||
[ "rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "my" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "$p" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "(" ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", ".." ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "$num_primes" ],
|
||||
[ "constant.numeric", "-1" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "if" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "$number_to_check" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "%" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "$primes" ],
|
||||
[ "lparen", "[" ],
|
||||
[ "identifier", "$p" ],
|
||||
[ "rparen", "]" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "==" ],
|
||||
[ "text", " " ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "keyword", "next" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "MAIN_LOOP" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "# If we reached this point it means $number_to_check is not" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "comment", "# divisable by any prime number that came before it." ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "$primes" ],
|
||||
[ "lparen", "[" ],
|
||||
[ "identifier", "$num_primes" ],
|
||||
[ "rparen", "]" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", "=" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "$number_to_check" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "identifier", "$num_primes" ],
|
||||
[ "keyword.operator", "++" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "keyword", "for" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword", "my" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "$p" ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "(" ],
|
||||
[ "constant.numeric", "0" ],
|
||||
[ "text", " " ],
|
||||
[ "keyword.operator", ".." ],
|
||||
[ "text", " " ],
|
||||
[ "lparen", "(" ],
|
||||
[ "identifier", "$num_primes" ],
|
||||
[ "constant.numeric", "-1" ],
|
||||
[ "rparen", ")" ],
|
||||
[ "rparen", ")" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "lparen", "{" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "text", " " ],
|
||||
[ "support.function", "print" ],
|
||||
[ "text", " " ],
|
||||
[ "identifier", "$primes" ],
|
||||
[ "lparen", "[" ],
|
||||
[ "identifier", "$p" ],
|
||||
[ "rparen", "]" ],
|
||||
[ "keyword.operator", "," ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\", \"" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "rparen", "}" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": [
|
||||
[ "support.function", "print" ],
|
||||
[ "text", " " ],
|
||||
[ "string", "\"\\n\"" ],
|
||||
[ "text", ";" ]
|
||||
]
|
||||
},
|
||||
{
|
||||
"state": "start",
|
||||
"data": []
|
||||
}
|
||||
]
|
||||
+1020
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user