redcar 0.9.2 → 0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +34 -4
- data/Rakefile +2 -1
- data/lib/redcar.rb +3 -3
- data/lib/redcar/installer.rb +2 -3
- data/plugins/application/features/step_definitions/dialog_steps.rb +7 -0
- data/plugins/application/features/step_definitions/key_steps.rb +18 -0
- data/plugins/application/features/step_definitions/menu_steps.rb +5 -6
- data/plugins/application/features/step_definitions/speedbar_steps.rb +29 -9
- data/plugins/application/features/step_definitions/tree_steps.rb +13 -0
- data/plugins/application/features/support/env.rb +39 -5
- data/plugins/application/features/support/fake_event.rb +12 -0
- data/plugins/application/lib/application.rb +5 -6
- data/plugins/application/lib/application/dialog.rb +53 -10
- data/plugins/application/lib/application/dialogs/modeless_list_dialog.rb +85 -0
- data/plugins/application/lib/application/keymap.rb +10 -8
- data/plugins/application/lib/application/menu.rb +38 -16
- data/plugins/application/lib/application/treebook.rb +30 -0
- data/plugins/application/lib/application/window.rb +20 -2
- data/plugins/application/spec/application/command/executor_spec.rb +1 -0
- data/plugins/application/spec/application/menu_spec.rb +26 -26
- data/plugins/application/spec/application/treebook_spec.rb +6 -6
- data/plugins/application/spec/spec_helper.rb +10 -1
- data/plugins/application_swt/lib/application_swt.rb +25 -3
- data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +48 -27
- data/plugins/application_swt/lib/application_swt/dialogs/filter_list_dialog_controller.rb +22 -11
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_dialog.rb +113 -0
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_html_dialog.rb +85 -0
- data/plugins/application_swt/lib/application_swt/dialogs/modeless_list_dialog_controller.rb +143 -0
- data/plugins/application_swt/lib/application_swt/gradient.rb +61 -0
- data/plugins/application_swt/lib/application_swt/menu/binding_translator.rb +4 -4
- data/plugins/application_swt/lib/application_swt/notebook.rb +5 -8
- data/plugins/application_swt/lib/application_swt/speedbar.rb +1 -0
- data/plugins/application_swt/lib/application_swt/treebook.rb +6 -8
- data/plugins/application_swt/lib/application_swt/window.rb +85 -57
- data/plugins/application_swt/lib/swt/graphics_utils.rb +23 -0
- data/plugins/application_swt/lib/swt/vtab_folder.rb +7 -0
- data/plugins/application_swt/lib/swt/vtab_label.rb +1 -1
- data/plugins/application_swt/spec/application_swt/gradient_spec.rb +142 -0
- data/plugins/auto_completer/lib/auto_completer.rb +10 -42
- data/plugins/auto_completer/lib/auto_completer/list_dialog.rb +21 -0
- data/plugins/clojure/lib/clojure.rb +33 -0
- data/plugins/{repl/lib/repl/clojure_mirror.rb → clojure/lib/clojure/repl_mirror.rb} +16 -20
- data/plugins/clojure/plugin.rb +9 -0
- data/plugins/{repl/spec/repl/clojure_mirror_spec.rb → clojure/spec/clojure/repl_mirror_spec.rb} +12 -13
- data/plugins/clojure/spec/spec_helper.rb +5 -0
- data/plugins/{repl → clojure}/vendor/Wrapper.clj +0 -0
- data/plugins/{repl → clojure}/vendor/dummy +0 -0
- data/plugins/{repl → clojure}/vendor/enclojure-wrapper.jar +0 -0
- data/plugins/connection_manager/lib/connection_manager.rb +13 -13
- data/plugins/declarations/lib/declarations.rb +17 -6
- data/plugins/document_search/features/find.feature +389 -0
- data/plugins/document_search/features/find_and_replace.feature +723 -0
- data/plugins/document_search/features/replace.feature +69 -62
- data/plugins/document_search/lib/document_search.rb +81 -64
- data/plugins/document_search/lib/document_search/commands.rb +258 -0
- data/plugins/document_search/lib/document_search/find_and_replace_speedbar.rb +142 -0
- data/plugins/document_search/lib/document_search/find_speedbar.rb +102 -0
- data/plugins/document_search/lib/document_search/query_options.rb +45 -0
- data/plugins/edit_view/features/case_change.feature +9 -5
- data/plugins/edit_view/features/step_definitions/editing_steps.rb +19 -0
- data/plugins/edit_view/lib/edit_view.rb +15 -12
- data/plugins/edit_view/lib/edit_view/actions/arrow_keys.rb +12 -2
- data/plugins/edit_view/lib/edit_view/commands/text_conversion_commands.rb +1 -1
- data/plugins/edit_view/lib/edit_view/document.rb +129 -99
- data/plugins/edit_view_swt/lib/edit_view_swt.rb +33 -15
- data/plugins/encryption/encryption.rb +2 -0
- data/plugins/find-in-project/lib/find_in_project.rb +3 -5
- data/plugins/find-in-project/lib/find_in_project/views/index.html.erb +2 -0
- data/plugins/groovy/features/step_definitions/groovy_steps.rb +2 -2
- data/plugins/groovy/features/syntax_check_groovy.feature +3 -3
- data/plugins/groovy/lib/groovy.rb +38 -0
- data/plugins/groovy/lib/groovy/commands.rb +10 -0
- data/plugins/{repl/lib/repl/groovy_mirror.rb → groovy/lib/groovy/repl_mirror.rb} +33 -13
- data/plugins/groovy/lib/{syntax_check/groovy.rb → groovy/syntax_checker.rb} +13 -8
- data/plugins/groovy/plugin.rb +5 -4
- data/plugins/{repl/spec/repl/groovy_mirror_spec.rb → groovy/spec/groovy/repl_mirror_spec.rb} +14 -13
- data/plugins/groovy/spec/spec_helper.rb +5 -0
- data/plugins/html_view/assets/json2.js +476 -0
- data/plugins/html_view/lib/html_view.rb +1 -0
- data/plugins/java/features/fixtures/test.java +0 -0
- data/plugins/java/features/support/env.rb +27 -0
- data/plugins/java/features/syntax_check_java.feature +86 -0
- data/plugins/java/lib/syntax_check/java.rb +86 -0
- data/plugins/java/plugin.rb +7 -0
- data/plugins/javascript/features/fixtures/test2.js +5 -0
- data/plugins/javascript/features/step_definitions/javascript_steps.rb +16 -0
- data/plugins/javascript/features/support/env.rb +14 -0
- data/plugins/javascript/features/syntax_check_javascript.feature +46 -3
- data/plugins/javascript/lib/syntax_check/javascript.rb +15 -9
- data/plugins/line_tools/features/trim_line.feature +49 -0
- data/plugins/line_tools/lib/line_tools.rb +5 -1
- data/plugins/mirah/README +7 -0
- data/plugins/mirah/features/fixtures/test.mirah +2 -0
- data/plugins/mirah/features/syntax_check_mirah.feature +46 -0
- data/plugins/mirah/lib/mirah.rb +43 -0
- data/plugins/mirah/lib/mirah/my_error_handler.rb +22 -0
- data/plugins/mirah/lib/mirah/repl_mirror.rb +50 -0
- data/plugins/mirah/lib/mirah/syntax_checker.rb +38 -0
- data/plugins/mirah/plugin.rb +8 -0
- data/plugins/mirah/spec/mirah/repl_mirror_spec.rb +188 -0
- data/plugins/mirah/spec/spec_helper.rb +5 -0
- data/plugins/mirah/vendor/mirah-parser.jar +0 -0
- data/plugins/pair_highlighter/lib/pair_highlighter/document_controller.rb +24 -23
- data/plugins/plugin_manager_ui/lib/plugin_manager_ui.rb +10 -1
- data/plugins/plugin_manager_ui/views/index.html.erb +2 -0
- data/plugins/project/features/find_file.feature +40 -16
- data/plugins/project/features/highlight_focussed_tab.feature +16 -10
- data/plugins/project/features/step_definitions/find_file_steps.rb +11 -0
- data/plugins/project/features/step_definitions/project_tree_steps.rb +5 -1
- data/plugins/project/features/support/env.rb +5 -0
- data/plugins/project/lib/project/commands.rb +8 -1
- data/plugins/project/lib/project/dir_controller.rb +4 -1
- data/plugins/project/lib/project/find_file_dialog.rb +16 -12
- data/plugins/project/lib/project/manager.rb +30 -1
- data/plugins/project_search/vendor/lucene/CHANGELOG +147 -0
- data/plugins/project_search/vendor/lucene/CONTRIBUTORS +17 -0
- data/plugins/project_search/vendor/lucene/Gemfile +9 -0
- data/plugins/project_search/vendor/lucene/Gemfile.lock +33 -0
- data/plugins/project_search/vendor/lucene/LICENSE +19 -0
- data/plugins/project_search/vendor/lucene/README.rdoc +283 -0
- data/plugins/project_search/vendor/lucene/Rakefile +35 -0
- data/plugins/project_search/vendor/lucene/examples/active_model/serializers.rb +25 -0
- data/plugins/project_search/vendor/lucene/examples/active_model/validation.rb +26 -0
- data/plugins/project_search/vendor/lucene/examples/admin/Rakefile +4 -0
- data/plugins/project_search/vendor/lucene/examples/admin/admin.rb +29 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/jquery.js +4376 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo4j.css +153 -0
- data/plugins/project_search/vendor/lucene/examples/admin/public/neo_admin.js +18 -0
- data/plugins/project_search/vendor/lucene/examples/admin/spec/admin_spec.rb +26 -0
- data/plugins/project_search/vendor/lucene/examples/admin/views/index.erb +21 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/README.rdoc +9 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/app.rb +7 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/batch.props +5 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/step_definitions/add_steps.rb +121 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/env.rb +30 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/support/rspec_helper.rb +50 -0
- data/plugins/project_search/vendor/lucene/examples/filetree/features/treesizes.feature +19 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/1_create_neo_db.rb +66 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/2_index_db.rb +23 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/README +12 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/find_actors.rb +56 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/install.sh +12 -0
- data/plugins/project_search/vendor/lucene/examples/imdb/model.rb +37 -0
- data/plugins/project_search/vendor/lucene/examples/railway/README +111 -0
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-app.rb +31 -0
- data/plugins/project_search/vendor/lucene/examples/railway/railnet-data.rb +42 -0
- data/plugins/project_search/vendor/lucene/examples/rest/example.rb +41 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/YouMightKnow.java +60 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/all_simple_paths.rb +34 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/nodes.rb +34 -0
- data/plugins/project_search/vendor/lucene/examples/you_might_know/you_might_know.rb +50 -0
- data/plugins/project_search/vendor/lucene/lib/lucene.rb +15 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/config.rb +145 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/document.rb +96 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/field_info.rb +144 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/hits.rb +54 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index.rb +267 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index_info.rb +146 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/index_searcher.rb +157 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/jars.rb +5 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/query_dsl.rb +135 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/transaction.rb +117 -0
- data/plugins/project_search/vendor/lucene/lib/lucene/version.rb +3 -0
- data/plugins/project_search/vendor/lucene/lucene.gemspec +23 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/document_spec.rb +32 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/field_info_spec.rb +70 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/index_info_spec.rb +76 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/index_spec.rb +643 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/query_dsl_spec.rb +142 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/sort_spec.rb +101 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/spec_helper.rb +10 -0
- data/plugins/project_search/vendor/lucene/spec/lucene/transaction_spec.rb +118 -0
- data/plugins/redcar/features/alter_font_size.feature +25 -0
- data/plugins/redcar/features/step_definitions/font_steps.rb +34 -0
- data/plugins/redcar/redcar.rb +256 -43
- data/plugins/repl/features/command_editing.feature +55 -0
- data/plugins/repl/features/command_history.feature +75 -0
- data/plugins/repl/features/step_definitions/repl_steps.rb +17 -1
- data/plugins/repl/features/support/env.rb +24 -0
- data/plugins/repl/features/support/fake_repl.rb +16 -0
- data/plugins/repl/lib/repl.rb +17 -74
- data/plugins/repl/lib/repl/repl_command.rb +20 -0
- data/plugins/repl/lib/repl/repl_mirror.rb +168 -22
- data/plugins/repl/lib/repl/repl_tab.rb +131 -6
- data/plugins/repl/plugin.rb +1 -1
- data/plugins/repl/spec/repl/repl_mirror_spec.rb +72 -0
- data/plugins/repl/spec/spec_helper.rb +1 -1
- data/plugins/repl_swt/lib/repl_swt.rb +7 -0
- data/plugins/repl_swt/lib/repl_swt/key_listener.rb +43 -0
- data/plugins/repl_swt/plugin.rb +8 -0
- data/plugins/ruby/lib/ruby.rb +35 -0
- data/plugins/{repl/lib/repl/ruby_mirror.rb → ruby/lib/ruby/repl_mirror.rb} +12 -12
- data/plugins/ruby/lib/{syntax_check/ruby.rb → ruby/syntax_checker.rb} +3 -3
- data/plugins/ruby/plugin.rb +5 -4
- data/plugins/{repl/spec/repl/ruby_mirror_spec.rb → ruby/spec/ruby/repl_mirror_spec.rb} +38 -29
- data/plugins/ruby/spec/spec_helper.rb +5 -0
- data/plugins/runnables/lib/runnables.rb +2 -0
- data/plugins/runnables/lib/runnables/command_output_controller.rb +5 -0
- data/plugins/runnables/lib/runnables/output_processor.rb +14 -3
- data/plugins/runnables/views/command_output.html.erb +3 -2
- data/plugins/scm/lib/scm.rb +4 -2
- data/plugins/scm/lib/scm/diff_mirror.rb +6 -6
- data/plugins/scm_git/lib/scm_git.rb +136 -107
- data/plugins/scm_git/lib/scm_git/change.rb +28 -19
- data/plugins/snippets/lib/snippets/explorer.rb +2 -2
- data/plugins/swt/lib/swt/full_swt.rb +1 -0
- data/plugins/syntax_check/features/step_definitions/syntax_check_steps.rb +4 -0
- data/plugins/syntax_check/features/support/env.rb +3 -0
- data/plugins/syntax_check/lib/syntax_check.rb +71 -5
- data/plugins/syntax_check/lib/syntax_check/annotation.rb +61 -0
- data/plugins/test_runner/lib/test_runner.rb +39 -0
- data/plugins/test_runner/lib/test_runner/rspec_runner.rb +20 -0
- data/plugins/test_runner/lib/test_runner/run_test_command.rb +63 -0
- data/plugins/test_runner/lib/test_runner/runnable_test_runner.rb +26 -0
- data/plugins/test_runner/plugin.rb +8 -0
- data/plugins/test_runner/spec/run_test_command_spec.rb +51 -0
- data/plugins/test_runner/spec/spec_helper.rb +5 -0
- data/plugins/textmate/lib/textmate.rb +12 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/HTML.tmbundle/Syntaxes/HTML.plist +0 -2
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/Syntaxes/Mirah.plist +22 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Mirah.tmbundle/info.plist +12 -0
- data/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby.tmbundle/Syntaxes/Ruby.plist +2 -0
- data/plugins/todo_list/lib/todo_list.rb +7 -0
- data/plugins/todo_list/lib/todo_list/todo_controller.rb +3 -1
- data/plugins/tree/lib/tree.rb +4 -0
- data/plugins/tree_view_swt/lib/tree_view_swt.rb +5 -0
- data/plugins/web_bookmarks/lib/web_bookmarks.rb +10 -0
- metadata +137 -22
- data/plugins/document_search/features/search.feature +0 -163
- data/plugins/document_search/lib/document_search/replace_all_command.rb +0 -27
- data/plugins/document_search/lib/document_search/replace_command.rb +0 -38
- data/plugins/document_search/lib/document_search/replace_next_command.rb +0 -27
- data/plugins/document_search/lib/document_search/search_and_replace.rb +0 -81
- data/plugins/ruby/README +0 -6
@@ -0,0 +1,46 @@
|
|
1
|
+
Feature: Syntax Checking for Mirah
|
2
|
+
As a user
|
3
|
+
I want to get annotations on syntax errors and warnings in Mirah files
|
4
|
+
|
5
|
+
Background:
|
6
|
+
When I have opened "plugins/mirah/features/fixtures/test.mirah"
|
7
|
+
|
8
|
+
Scenario: A syntax-clean Mirah file has no syntax error annotations
|
9
|
+
When I replace the contents with "def foo\n bar\nend"
|
10
|
+
And I save the tab
|
11
|
+
And I wait 2 seconds
|
12
|
+
Then the tab should not have annotations
|
13
|
+
|
14
|
+
Scenario: A syntax-error in a Mirah file should cause syntax error annotations
|
15
|
+
When I replace the contents with "def foo\n => bar\nend"
|
16
|
+
And I save the tab
|
17
|
+
And I wait 2 seconds
|
18
|
+
Then the tab should have annotations
|
19
|
+
And the tab should have an annotation on line 2
|
20
|
+
|
21
|
+
Scenario: A syntax-warning in a Mirah file should cause syntax warning annotations
|
22
|
+
When I replace the contents with "def foo\n end"
|
23
|
+
And I save the tab
|
24
|
+
And I wait 2 seconds
|
25
|
+
Then the tab should have annotations
|
26
|
+
And the tab should have an annotation on line 2
|
27
|
+
|
28
|
+
Scenario: Fixing a syntax-error in a Mirah file should cause syntax error annotations to vanish
|
29
|
+
When I replace the contents with "def foo\n => bar\nend"
|
30
|
+
And I save the tab
|
31
|
+
And I wait 2 seconds
|
32
|
+
Then the tab should have annotations
|
33
|
+
When I replace the contents with "def foo\n bar\nend"
|
34
|
+
And I save the tab
|
35
|
+
And I wait 2 seconds
|
36
|
+
Then the tab should not have annotations
|
37
|
+
|
38
|
+
Scenario: Fixing a syntax-warning in a Mirah file should cause syntax error annotations to vanish
|
39
|
+
When I replace the contents with "def foo\n end"
|
40
|
+
And I save the tab
|
41
|
+
And I wait 2 seconds
|
42
|
+
Then the tab should have annotations
|
43
|
+
When I replace the contents with "def foo\nend"
|
44
|
+
And I save the tab
|
45
|
+
And I wait 2 seconds
|
46
|
+
Then the tab should not have annotations
|
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
require 'java'
|
3
|
+
require 'mirah/syntax_checker'
|
4
|
+
require 'mirah/repl_mirror'
|
5
|
+
|
6
|
+
module Redcar
|
7
|
+
class Mirah
|
8
|
+
|
9
|
+
def self.menus
|
10
|
+
Menu::Builder.build do
|
11
|
+
sub_menu "Plugins" do
|
12
|
+
sub_menu "REPL" do
|
13
|
+
item "Open Mirah REPL", MirahOpenREPL
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.load_dependencies
|
20
|
+
unless @loaded
|
21
|
+
require File.join(File.dirname(__FILE__),'..','vendor','mirah-parser')
|
22
|
+
import 'mirah.impl.MirahParser'
|
23
|
+
import 'jmeta.ErrorHandler'
|
24
|
+
require 'mirah/my_error_handler'
|
25
|
+
@loaded = true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.storage
|
30
|
+
@storage ||= begin
|
31
|
+
storage = Plugin::Storage.new('mirah')
|
32
|
+
storage.set_default('check_for_warnings', true)
|
33
|
+
storage
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class MirahOpenREPL < Redcar::REPL::OpenREPL
|
38
|
+
def execute
|
39
|
+
open_repl(ReplMirror.new)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
module Redcar
|
3
|
+
class Mirah
|
4
|
+
class MyErrorHandler
|
5
|
+
include ErrorHandler
|
6
|
+
|
7
|
+
def problem(m)
|
8
|
+
(@problems||=[]) << m
|
9
|
+
end
|
10
|
+
|
11
|
+
def problems
|
12
|
+
@problems || []
|
13
|
+
end
|
14
|
+
|
15
|
+
def warning(messages, positions)
|
16
|
+
messages.length.times { |i|
|
17
|
+
problem "Warning: #{messages[i]} #{positions[i]}"
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
module Redcar
|
3
|
+
class Mirah
|
4
|
+
class ReplMirror < Redcar::REPL::ReplMirror
|
5
|
+
|
6
|
+
def title
|
7
|
+
"Mirah REPL"
|
8
|
+
end
|
9
|
+
|
10
|
+
def grammar_name
|
11
|
+
"Ruby REPL"
|
12
|
+
end
|
13
|
+
|
14
|
+
def prompt
|
15
|
+
">>"
|
16
|
+
end
|
17
|
+
|
18
|
+
def format_error(e)
|
19
|
+
backtrace = e.backtrace.reject{|l|
|
20
|
+
l =~ /(repl_mirror|redcar)/
|
21
|
+
}
|
22
|
+
backtrace.unshift("(repl):1")
|
23
|
+
"#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def evaluator
|
27
|
+
@evaluator ||= ReplMirror::Evaluator.new
|
28
|
+
end
|
29
|
+
|
30
|
+
class Evaluator
|
31
|
+
attr_reader :output
|
32
|
+
|
33
|
+
def initialize
|
34
|
+
Mirah.load_dependencies
|
35
|
+
@binding = binding
|
36
|
+
@impl = Java::MirahImpl::Mirah.new
|
37
|
+
@output = nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def inspect
|
41
|
+
"main"
|
42
|
+
end
|
43
|
+
|
44
|
+
def execute(command)
|
45
|
+
@impl.instance_eval(command).inspect
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
module Redcar
|
3
|
+
class Mirah
|
4
|
+
class SyntaxChecker < Redcar::SyntaxCheck::Checker
|
5
|
+
supported_grammars "Mirah"
|
6
|
+
|
7
|
+
def check(*args)
|
8
|
+
Mirah.load_dependencies
|
9
|
+
check_warnings = Mirah.storage['check_for_warnings']
|
10
|
+
path = manifest_path(doc)
|
11
|
+
|
12
|
+
parser = MirahParser.new
|
13
|
+
parser.filename = path
|
14
|
+
|
15
|
+
handler = MyErrorHandler.new
|
16
|
+
parser.errorHandler = handler
|
17
|
+
|
18
|
+
begin
|
19
|
+
parser.parse(IO.read(path))
|
20
|
+
rescue
|
21
|
+
m = $!.message
|
22
|
+
error = m.split(" (").first
|
23
|
+
if info = m.match(/line: ([0-9]+), char: ([0-9]+)\)/)
|
24
|
+
SyntaxCheck::Error.new(doc, info[1].to_i-1, error).annotate
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if check_warnings
|
29
|
+
handler.problems.each do |problem|
|
30
|
+
if info = problem.match(/line: ([0-9]+), char: ([0-9]+)\)/)
|
31
|
+
SyntaxCheck::Warning.new(doc, info[1].to_i-1, problem.split(" (").first).annotate
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,188 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
+
|
3
|
+
class Redcar::Mirah
|
4
|
+
describe ReplMirror do
|
5
|
+
before do
|
6
|
+
@mirror = ReplMirror.new
|
7
|
+
@changed_event = false
|
8
|
+
@mirror.add_listener(:change) { @changed_event = true }
|
9
|
+
end
|
10
|
+
|
11
|
+
def commit_test_text1
|
12
|
+
text = <<-MIRAH
|
13
|
+
# Mirah REPL
|
14
|
+
# type 'help' for help
|
15
|
+
|
16
|
+
>> $internal_repl_test = 707
|
17
|
+
MIRAH
|
18
|
+
@mirror.commit(text.chomp)
|
19
|
+
end
|
20
|
+
|
21
|
+
def result_test_text1
|
22
|
+
(<<-MIRAH).chomp
|
23
|
+
# Mirah REPL
|
24
|
+
# type 'help' for help
|
25
|
+
|
26
|
+
>> $internal_repl_test = 707
|
27
|
+
=> 707
|
28
|
+
>>
|
29
|
+
MIRAH
|
30
|
+
end
|
31
|
+
|
32
|
+
def commit_test_text2
|
33
|
+
text = <<-MIRAH
|
34
|
+
# Mirah REPL
|
35
|
+
# type 'help' for help
|
36
|
+
|
37
|
+
>> $internal_repl_test = 707
|
38
|
+
=> 707
|
39
|
+
>> $internal_repl_test = 909
|
40
|
+
MIRAH
|
41
|
+
@mirror.commit(text.chomp)
|
42
|
+
text.chomp
|
43
|
+
end
|
44
|
+
|
45
|
+
def result_test_text2
|
46
|
+
(<<-MIRAH).chomp
|
47
|
+
# Mirah REPL
|
48
|
+
# type 'help' for help
|
49
|
+
|
50
|
+
>> $internal_repl_test = 707
|
51
|
+
=> 707
|
52
|
+
>> $internal_repl_test = 909
|
53
|
+
=> 909
|
54
|
+
>>
|
55
|
+
MIRAH
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
def commit_no_input
|
60
|
+
text = <<-MIRAH
|
61
|
+
# Mirah REPL
|
62
|
+
# type 'help' for help
|
63
|
+
|
64
|
+
>>
|
65
|
+
MIRAH
|
66
|
+
@mirror.commit(text)
|
67
|
+
end
|
68
|
+
|
69
|
+
def prompt
|
70
|
+
"# Mirah REPL\n\n"
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "with no history" do
|
74
|
+
it "should exist" do
|
75
|
+
@mirror.should be_exist
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should have a message and a prompt" do
|
79
|
+
@mirror.read.should == (<<-MIRAH).chomp
|
80
|
+
# Mirah REPL
|
81
|
+
# type 'help' for help
|
82
|
+
|
83
|
+
>>
|
84
|
+
MIRAH
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should have a title" do
|
88
|
+
@mirror.title.should == "Mirah REPL"
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should not be changed" do
|
92
|
+
@mirror.should_not be_changed
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "when executing" do
|
96
|
+
it "should execute committed text" do
|
97
|
+
commit_test_text1
|
98
|
+
$internal_repl_test.should == 707
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should allow committing nothing as the first command" do
|
102
|
+
commit_no_input
|
103
|
+
@mirror.read.should == "# Mirah REPL\n# type 'help' for help\n\n>> \n=> nil\n>> "
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should allow committing nothing as an xth command" do
|
107
|
+
committed = commit_test_text2
|
108
|
+
@mirror.commit committed + "\n>> "
|
109
|
+
@mirror.read.should == "# Mirah REPL\n# type 'help' for help\n\n>> $internal_repl_test = 909\n=> 909\n>> \n=> nil\n>> "
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should emit changed event when text is executed" do
|
113
|
+
commit_test_text1
|
114
|
+
@changed_event.should be_true
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should now have the command and the result at the end" do
|
118
|
+
commit_test_text1
|
119
|
+
@mirror.read.should == result_test_text1
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should display errors" do
|
123
|
+
@mirror.commit(prompt + ">> nil.foo")
|
124
|
+
text = <<-MIRAH
|
125
|
+
# Mirah REPL
|
126
|
+
# type 'help' for help
|
127
|
+
|
128
|
+
>> nil.foo
|
129
|
+
x> NoMethodError: undefined method `foo' for nil:NilClass
|
130
|
+
(repl):1
|
131
|
+
MIRAH
|
132
|
+
@mirror.read.include?(text).should be_true
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
describe "with a history" do
|
138
|
+
before do
|
139
|
+
commit_test_text1
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should not have changed" do
|
143
|
+
@mirror.changed?.should be_false
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should display the history and prompt correctly" do
|
147
|
+
@mirror.read.should == result_test_text1
|
148
|
+
end
|
149
|
+
|
150
|
+
describe "when executing" do
|
151
|
+
it "should execute committed text" do
|
152
|
+
commit_test_text2
|
153
|
+
$internal_repl_test.should == 909
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should show the correct history" do
|
157
|
+
commit_test_text2
|
158
|
+
@mirror.read.should == result_test_text2
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should allow the history to be cleared" do
|
162
|
+
@mirror.clear_history
|
163
|
+
@mirror.read.should == ">> "
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# somehow ...
|
170
|
+
# describe "when executing" do
|
171
|
+
# it "should persist local variables" do
|
172
|
+
# sent = prompt + ">> a = 13"
|
173
|
+
# @mirror.commit(sent)
|
174
|
+
# @mirror.commit(sent + "\n>> a")
|
175
|
+
# @mirror.read.should == (<<-MIRAH).chomp
|
176
|
+
# # Mirah REPL
|
177
|
+
# # type 'help' for help
|
178
|
+
#
|
179
|
+
# >> a = 13
|
180
|
+
# => 13
|
181
|
+
# >> a
|
182
|
+
# => 13
|
183
|
+
# >>
|
184
|
+
# MIRAH
|
185
|
+
# end
|
186
|
+
# end
|
187
|
+
end
|
188
|
+
end
|
Binary file
|
@@ -5,7 +5,7 @@ module Redcar
|
|
5
5
|
|
6
6
|
attr_accessor :gc, :styledText, :document, :mate_text, :theme_name
|
7
7
|
attr_accessor :height, :width, :highlighted
|
8
|
-
|
8
|
+
|
9
9
|
include Redcar::Document::Controller
|
10
10
|
include Redcar::Document::Controller::ModificationCallbacks
|
11
11
|
include Redcar::Document::Controller::CursorCallbacks
|
@@ -14,14 +14,14 @@ module Redcar
|
|
14
14
|
if @theme_name == EditView.theme
|
15
15
|
return @colour if @colour
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
@theme_name = EditView.theme
|
19
19
|
@theme = @mate_text.colourer.getTheme()
|
20
20
|
@colour = @theme.globalSettings.get("pairHighlight")
|
21
21
|
if @colour
|
22
22
|
@colour = JavaMateView::SwtColourer.getColour(@colour)
|
23
23
|
else
|
24
|
-
@colour = ApplicationSWT.display.system_color Swt::SWT::COLOR_GRAY
|
24
|
+
@colour = ApplicationSWT.display.system_color Swt::SWT::COLOR_GRAY
|
25
25
|
end
|
26
26
|
@colour
|
27
27
|
end
|
@@ -57,15 +57,15 @@ module Redcar
|
|
57
57
|
clear
|
58
58
|
#puts "Highligh on offset " + current.to_s() + " and its pair at " + pair.to_s()
|
59
59
|
gc = Swt::Graphics::GC.new(@styledText)
|
60
|
-
gc.setBackground(set_highlight_colour)
|
60
|
+
gc.setBackground(set_highlight_colour)
|
61
61
|
gc.setAlpha(98)
|
62
62
|
gc.fill_rectangle(styledText.getTextBounds(current, current))
|
63
|
-
gc.fill_rectangle(styledText.getTextBounds(pair, pair))
|
63
|
+
gc.fill_rectangle(styledText.getTextBounds(pair, pair))
|
64
64
|
@highlight.set_on(current, pair)
|
65
65
|
gc.dispose() if gc
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
def clear
|
70
70
|
if @highlight.on?
|
71
71
|
styledText.redrawRange(@highlight.current, 1, false) if @highlight.current < document.length
|
@@ -73,14 +73,14 @@ module Redcar
|
|
73
73
|
@highlight.clear
|
74
74
|
end
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
def find_pair(step, offset, search_char, current_char)
|
78
78
|
state = 1;
|
79
79
|
quotes = false
|
80
80
|
doublequotes = false
|
81
|
-
|
81
|
+
|
82
|
+
offset = offset + step;
|
82
83
|
while offset >= 0 and offset < document.length
|
83
|
-
offset = offset + step;
|
84
84
|
@newchar = styledText.getTextRange(offset, 1)
|
85
85
|
if @newchar == search_char and !quotes and !doublequotes
|
86
86
|
state = state - 1
|
@@ -94,8 +94,9 @@ module Redcar
|
|
94
94
|
if state == 0
|
95
95
|
return offset
|
96
96
|
end
|
97
|
+
offset = offset + step;
|
97
98
|
end
|
98
|
-
|
99
|
+
|
99
100
|
if state != 0
|
100
101
|
return nil
|
101
102
|
end
|
@@ -121,47 +122,47 @@ module Redcar
|
|
121
122
|
if @wait > 0
|
122
123
|
return
|
123
124
|
end
|
124
|
-
|
125
|
+
|
125
126
|
pair = nil
|
126
|
-
|
127
|
+
|
127
128
|
if offset >= document.length
|
128
129
|
@char_next = nil
|
129
130
|
else
|
130
|
-
@char_next = document.get_range(offset, 1)
|
131
|
+
@char_next = document.get_range(offset, 1)
|
131
132
|
end
|
132
|
-
|
133
|
+
|
133
134
|
if offset > 0
|
134
|
-
@char_prev = document.get_range(offset-1, 1)
|
135
|
+
@char_prev = document.get_range(offset-1, 1)
|
135
136
|
else
|
136
137
|
@char_prev = nil
|
137
138
|
end
|
138
|
-
|
139
|
+
|
139
140
|
if @char_next and @pair_chars.include?(@char_next)
|
140
|
-
pair = pair_of_offset(offset)
|
141
|
+
pair = pair_of_offset(offset)
|
141
142
|
elsif @char_prev and @pair_chars.include?(@char_prev)
|
142
143
|
offset = offset - 1
|
143
144
|
pair = pair_of_offset(offset)
|
144
145
|
else
|
145
146
|
clear
|
146
147
|
end
|
147
|
-
|
148
|
+
|
148
149
|
highlight_pair(offset, pair)
|
149
150
|
end
|
150
151
|
end
|
151
|
-
|
152
|
+
|
152
153
|
class Highlighted
|
153
154
|
attr_accessor :on, :current, :pair
|
154
|
-
|
155
|
+
|
155
156
|
def initialize
|
156
157
|
clear
|
157
158
|
end
|
158
|
-
|
159
|
+
|
159
160
|
def clear
|
160
161
|
@on = false
|
161
162
|
@current = nil
|
162
163
|
@pair = nil
|
163
164
|
end
|
164
|
-
|
165
|
+
|
165
166
|
def on?
|
166
167
|
if @on
|
167
168
|
true
|
@@ -169,7 +170,7 @@ module Redcar
|
|
169
170
|
false
|
170
171
|
end
|
171
172
|
end
|
172
|
-
|
173
|
+
|
173
174
|
def set_on(current, pair)
|
174
175
|
if current and pair
|
175
176
|
@on = true
|