diff --git a/Commands/@variable ||= memoized.tmCommand b/Commands/@variable ||= memoized.tmCommand new file mode 100644 index 0000000..843f2e3 --- /dev/null +++ b/Commands/@variable ||= memoized.tmCommand @@ -0,0 +1,46 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby18 + +line_number = ENV['TM_LINE_NUMBER'].to_i - 1 +# line = STDIN.lines.to_a[line_number-1] +# method_name = $1 if line =~ /def (?:self\.)?([a-z\d_]+)/i + +method_name = nil +lines = STDIN.lines.to_a[0..line_number-1].reverse +line = lines.find {|l| l =~ /\bdef (?:self\.)?([a-zA-Z\d_]+)/} +method_name = $1 if line + +ivar_name = (method_name != 'initialize' && method_name) || 'instance_variable' +assignment = method_name == 'initialize' ? '=' : '${2:||}=' + +print "@${1:#{ivar_name}} #{assignment} " +print '${3:$1}' unless ENV['TM_CURRENT_WORD'] + + input + document + inputFormat + text + name + @variable + outputCaret + afterOutput + outputFormat + snippet + outputLocation + atCaret + scope + source.ruby + tabTrigger + @ + uuid + 20ACDEEE-1F1D-4CFB-8B66-940E902693EF + version + 2 + + diff --git a/Commands/Check ERB Syntax.plist b/Commands/Check ERB Syntax.plist index bcde7c9..d62d70d 100644 --- a/Commands/Check ERB Syntax.plist +++ b/Commands/Check ERB Syntax.plist @@ -6,11 +6,24 @@ nop command #!/usr/bin/env ruby18 +require "shellwords" require ENV['TM_SUPPORT_PATH'] + '/lib/textmate' + puts "Using " + `"${TM_RUBY:=ruby}" -e'puts "ruby-" + RUBY_VERSION.to_s'`.chomp + " / " + `"${TM_ERB:=erb}" --version 2>&1`.chomp -result = `"${TM_ERB:=erb}" -T - -x | "${TM_RUBY:=ruby}" -c 2>&1` -puts result -TextMate.go_to :line => $1 if result =~ /-:(\d+):/ +puts result = `"${TM_ERB:=erb}" -T - -x | "${TM_RUBY:=ruby}" -c 2>&1` + +if result =~ /-:(\d+):(.*)/ + TextMate.go_to :line => $1 + `"$TM_MATE" -c warning` + result.each_line do |line| + if line =~ /-:(\d+):(.*)/ + `"$TM_MATE" --set-mark warning:#{Shellwords.escape($2)} --line #{$1}` + end + end +else + `"$TM_MATE" -c warning` +end + input document inputFormat diff --git a/Commands/Check Ruby Syntax.plist b/Commands/Check Ruby Syntax.plist index fa18747..fef49c0 100644 --- a/Commands/Check Ruby Syntax.plist +++ b/Commands/Check Ruby Syntax.plist @@ -6,11 +6,23 @@ nop command #!/usr/bin/env ruby18 +require "shellwords" require ENV['TM_SUPPORT_PATH'] + '/lib/textmate' + puts `"${TM_RUBY:=ruby}" -e'puts "Using ruby-" + RUBY_VERSION.to_s'` -result = `"${TM_RUBY:=ruby}" -wc 2>&1` -puts result -TextMate.go_to :line => $1 if result =~ /-:(\d+):/ +puts result = `"${TM_RUBY:=ruby}" -wc 2>&1` + +if result =~ /-:(\d+):(.*)/ + TextMate.go_to :line => $1 + `"$TM_MATE" -c warning` + result.each_line do |line| + if line =~ /-:(\d+):(.*)/ + `"$TM_MATE" --set-mark warning:#{Shellwords.escape($2)} --line #{$1}` + end + end +else + `"$TM_MATE" -c warning` +end input document diff --git a/Commands/Convert Ruby hash to 1_9 syntax.tmCommand b/Commands/Convert Ruby hash to 1_9 syntax.tmCommand index 2ab2652..2d9310f 100644 --- a/Commands/Convert Ruby hash to 1_9 syntax.tmCommand +++ b/Commands/Convert Ruby hash to 1_9 syntax.tmCommand @@ -7,10 +7,19 @@ command #!/usr/bin/env ruby18 -print case str = STDIN.read - when /=>/; str.gsub(/:(\w+)[\s]+=>[\s]+/, '\1: ') - when /(\w+):/; str.gsub(/(\w+):(\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\([^)]*\)|[^,]+))/, ":\\1 =>\\2") - else; str +def toggle_ruby_hash_syntax(str) + case str + when /\=>/ + str.gsub!(/:(\w+)\s*=>\s*/, '\1: ') + when /(\w+):/ + str.gsub!(/(\w+):(\s*(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\w+\([^)]*\)|[^,]+))/, ":\\1 =>\\2") + else + str + end +end + +while str = $stdin.gets + print toggle_ruby_hash_syntax(str) end fallbackInput diff --git a/Commands/Help.tmCommand b/Commands/Help.tmCommand new file mode 100644 index 0000000..7947417 --- /dev/null +++ b/Commands/Help.tmCommand @@ -0,0 +1,35 @@ + + + + + beforeRunningCommand + nop + command + #!/bin/bash + +. "$TM_SUPPORT_PATH/lib/webpreview.sh" + +html_header "Ruby Bundle Help" "Ruby" +"$TM_SUPPORT_PATH/lib/markdown_to_help.rb" \ + "$TM_BUNDLE_SUPPORT/help/help.markdown" +html_footer + input + none + inputFormat + text + name + Help + outputCaret + afterOutput + outputFormat + html + outputLocation + newWindow + scope + source.ruby + uuid + 535AF150-5613-44DB-AB41-EBB934A5865F + version + 2 + + \ No newline at end of file diff --git a/Commands/Lookup in Documentation (10.9).tmCommand b/Commands/Lookup in Documentation (Modern).tmCommand similarity index 94% rename from Commands/Lookup in Documentation (10.9).tmCommand rename to Commands/Lookup in Documentation (Modern).tmCommand index cc23893..1fa5afa 100644 --- a/Commands/Lookup in Documentation (10.9).tmCommand +++ b/Commands/Lookup in Documentation (Modern).tmCommand @@ -23,7 +23,7 @@ echo "<meta content='0;URL=file://$("${TM_BUNDLE_SUPPORT}/bin/ri_lookup" "${T outputLocation newWindow scope - source.ruby & attr.os-version.10.9 + source.ruby semanticClass lookup.define.ruby uuid diff --git a/Commands/Lookup in Documentation.plist b/Commands/Lookup in Documentation.plist index 5b95a83..96e0952 100644 --- a/Commands/Lookup in Documentation.plist +++ b/Commands/Lookup in Documentation.plist @@ -26,7 +26,7 @@ outputLocation toolTip scope - source.ruby + source.ruby & attr.os-version.10.6, source.ruby & attr.os-version.10.7, source.ruby & attr.os-version.10.8 semanticClass lookup.define.ruby uuid diff --git a/Commands/Reformat Document.tmCommand b/Commands/Reformat Document.tmCommand new file mode 100644 index 0000000..c2f68bc --- /dev/null +++ b/Commands/Reformat Document.tmCommand @@ -0,0 +1,54 @@ + + + + + beforeRunningCommand + saveModifiedFiles + command + #!usr/bin/env ruby18 + +# -- Imports ------------------------------------------------------------------- + +require ENV['TM_BUNDLE_SUPPORT'] + '/lib/rubocop' + +# -- Main ---------------------------------------------------------------------- + +RuboCop.reformat + + input + document + inputFormat + text + keyEquivalent + ^H + name + Reformat Document + outputCaret + heuristic + outputFormat + text + outputLocation + discard + requiredCommands + + + command + rubocop + moreInfoURL + http://batsov.com/rubocop/ + locations + + /usr/local/bin/rubocop + $HOME/.rbenv/shims/rubocop + $HOME/.rvm/scripts/rvm + + + + scope + source.ruby + uuid + 64BB4EE2-2803-410C-B140-EA545A13F250 + version + 2 + + \ No newline at end of file diff --git a/Commands/Run Script in Terminal.tmCommand b/Commands/Run Script in Terminal.tmCommand new file mode 100644 index 0000000..ce76097 --- /dev/null +++ b/Commands/Run Script in Terminal.tmCommand @@ -0,0 +1,82 @@ + + + + + beforeRunningCommand + nop + command + #!/bin/bash +[[ -z "$TM_FILEPATH" ]] && TM_TMPFILE=$(mktemp -t rubyInTerm) +: "${TM_FILEPATH:=$TM_TMPFILE}"; cat >"$TM_FILEPATH" + +# run script using either Terminal.app or iTerm.app +# if iTerm is open or if TM_TERMINAL is set to iTerm then use iTerm +# otherwise default to Terminal.app since that is standard. +TP=${TM_TERMINAL:=Terminal} +TPY=${TM_RUBY:=ruby} + +esc () { +STR="$1" ruby18 <<"RUBY" + str = ENV['STR'] + str = str.gsub(/'/, "'\\\\''") + str = str.gsub(/[\\"]/, '\\\\\\0') + print "'#{str}'" +RUBY +} + +iTerm_running () { + ruby <<"RUBY" + all = `ps -U "$USER" -o ucomm` + split = all.split("\n") + if split.find { |cmd| 'iTerm' == cmd.strip } + STDOUT.write 0 + else + STDOUT.write 1 + end +RUBY +} + +if [ "$TP" == iTerm ] || [ $(iTerm_running) == 0 ]; then + osascript <<END + tell application "iTerm" + activate + tell the current terminal + tell (launch session "TextMate") + write text "clear; cd $(esc "${TM_DIRECTORY}"); $(esc "${TPY}") $(esc "${TM_FILEPATH}"); rm -f $(esc "${TM_TMPFILE}")" + end tell + end tell + end tell +END +else + osascript <<- APPLESCRIPT + tell app "Terminal" + launch + activate + do script "clear; cd $(esc "${TM_DIRECTORY}"); $(esc "${TPY}") $(esc "${TM_FILEPATH}"); rm -f $(esc "${TM_TMPFILE}")" + set position of first window to { 100, 100 } + end tell +APPLESCRIPT +fi + + input + document + inputFormat + text + keyEquivalent + ^@R + name + Run in Terminal + outputCaret + afterOutput + outputFormat + text + outputLocation + discard + scope + source.ruby + uuid + 4444CB9A-8345-4116-8349-C359ADDA390C + version + 2 + + diff --git a/Commands/Toggle String:Symbol.tmCommand b/Commands/Toggle String:Symbol.tmCommand index 0619d80..3e5ca36 100644 --- a/Commands/Toggle String:Symbol.tmCommand +++ b/Commands/Toggle String:Symbol.tmCommand @@ -9,12 +9,24 @@ command #!/usr/bin/env ruby18 -print case str = STDIN.read - # Handle standard quotes - when /\A["'](\w+)["']\z/ then ":" + $1 - when /\A:(\w+)\z/ then '"' + $1 + '"' - # Default case - else str +require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes' + +def toggle_string_symbol(str) + case str + # "string" => :symbol + when /("|')(\w+)\1/ + str.gsub!(/("|')(\w+)\1/, ':\2') + # :symbol => "string" + when /:(\w+)/ + str.gsub!(/:(\w+)/, '"\1"') + # initial case (no changes) + else + str + end +end + +while str = $stdin.gets + print toggle_string_symbol(str) end fallbackInput @@ -28,7 +40,7 @@ end output replaceSelectedText scope - source.ruby string.quoted, source.ruby constant.other.symbol.ruby + source.ruby string.quoted, source.ruby constant.other.symbol, source.ruby constant.other.symbol.hashkey.ruby uuid B297E4B8-A8FF-49CE-B9C4-6D4911724D43 diff --git a/Preferences/Folding.tmPreferences b/Preferences/Folding.tmPreferences index 5145bd9..d6b08d6 100644 --- a/Preferences/Folding.tmPreferences +++ b/Preferences/Folding.tmPreferences @@ -11,7 +11,7 @@ foldingStartMarker (?x)^ (\s*+ - (module|class|def(?!.*\bend\s*$) + (module|class|(private\s+)?def(?!.*\bend\s*$) |unless|if |case |begin diff --git a/Preferences/Miscellaneous.plist b/Preferences/Miscellaneous.plist index b4b81ac..d7c1257 100644 --- a/Preferences/Miscellaneous.plist +++ b/Preferences/Miscellaneous.plist @@ -9,7 +9,7 @@ settings decreaseIndentPattern - ^\s*([}\]](,?\s*(#|$)|\.[a-zA-Z_]\w*\b)|(end|rescue|ensure|else|elsif|when)\b) + ^\s*([}\]]([,)]?\s*(#|$)|\.[a-zA-Z_]\w*\b)|(end|rescue|ensure|else|elsif|when)\b) increaseIndentPattern (?x)^ (\s* diff --git a/Preferences/Symbol List: Class.tmPreferences b/Preferences/Symbol List: Class.tmPreferences new file mode 100644 index 0000000..1d861b9 --- /dev/null +++ b/Preferences/Symbol List: Class.tmPreferences @@ -0,0 +1,19 @@ + + + + + name + Symbol List: Class + scope + meta.class.ruby + settings + + showInSymbolList + + symbolTransformation + s/^\s*class\s+// + + uuid + 64AFA1C0-BDC7-42DE-B3B5-C597538975E9 + + diff --git a/Snippets/#inspect.tmSnippet b/Snippets/#inspect.tmSnippet new file mode 100644 index 0000000..9e21b36 --- /dev/null +++ b/Snippets/#inspect.tmSnippet @@ -0,0 +1,16 @@ + + + + + content + inspect + name + #inspect + scope + source.ruby + tabTrigger + i + uuid + 2BB6D28F-914E-4132-BC53-E43CF5060BFA + + diff --git a/Snippets/class .. end (cla).plist b/Snippets/class .. end (cla).plist index 8839f4c..566a349 100644 --- a/Snippets/class .. end (cla).plist +++ b/Snippets/class .. end (cla).plist @@ -3,7 +3,7 @@ content - class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.rb)?/(?2::\u$1)/g}} + class ${1:${TM_FILENAME/(?:\A|_)([A-Za-z0-9]+)(?:\.[a-z]+)*/(?2::\u$1)/g}} $0 end name diff --git a/Snippets/embed string variable.plist b/Snippets/embed string variable.plist index 8fcbf79..eb73794 100644 --- a/Snippets/embed string variable.plist +++ b/Snippets/embed string variable.plist @@ -9,7 +9,7 @@ name Embedded Code — #{…} scope - B:(string.quoted.double.ruby|string.interpolated.ruby) - string source + source.ruby & B:(string.quoted.double|string.interpolated|meta.array.symbol.interpolated|string.quoted.other.interpolated|meta.array.string.interpolated) - string source uuid EEE6D060-C5A0-400D-A2E0-0835013C5365 diff --git a/Snippets/refine.tmSnippet b/Snippets/refine.tmSnippet new file mode 100644 index 0000000..35f5f6e --- /dev/null +++ b/Snippets/refine.tmSnippet @@ -0,0 +1,18 @@ + + + + + content + refine ${1:ClassName} do + $2 +end + name + refine … end + scope + source.ruby + tabTrigger + refine + uuid + 5CB8BCD2-20A5-45E5-A40B-7708C7B8763A + + diff --git "a/Snippets/require \"..\" (req).plist" b/Snippets/require '..' (req).plist similarity index 86% rename from "Snippets/require \"..\" (req).plist" rename to Snippets/require '..' (req).plist index ec8d265..a1919f4 100644 --- "a/Snippets/require \"..\" (req).plist" +++ b/Snippets/require '..' (req).plist @@ -3,9 +3,9 @@ content - require "$0" + require '$0' name - require ".." + require '..' scope source.ruby tabTrigger diff --git a/Support/bin/rvm_wrapper b/Support/bin/rvm_wrapper new file mode 100755 index 0000000..6096b7f --- /dev/null +++ b/Support/bin/rvm_wrapper @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" + +cd . # Activate rvm for the current directory +"$@" \ No newline at end of file diff --git a/Support/help/help.markdown b/Support/help/help.markdown new file mode 100644 index 0000000..9fef167 --- /dev/null +++ b/Support/help/help.markdown @@ -0,0 +1,27 @@ +# Reformat Document + +The command “Reformat Document” – accessible via ^ + + H – formats the current document using the `--auto-correct` option of [RuboCop][]. It also shows information about the formatting status in a floating tooltip. The command displays the information about the formatting status either as black text only, or as colorful text if [aha][] is accessible via `PATH`. + +[aha]: https://github.com/theZiz/aha +[RuboCop]: https://github.com/bbatsov/rubocop + +## Additional Options + +You can specify additional RuboCop options by setting the environment variable `TM_RUBOCOP_OPTIONS`. For example, if RuboCop should only autocorrect layout specific issues set the variable to the value `--only Layout`. + +## RuboCop Version + +Which version of [RuboCop][] “Reformat Document” uses depends on your environment. The command will try the options below in the given order. + +1. The value of the command specified via `TM_RUBOCOP`. +2. An executable version of RuboCop accessible via `bin/rubocop`. +3. The version of `rubocop` installed via [Bundler][]. +4. Any other version of `rubocop` accessible via, + - `/usr/local/bin/rubocop`, + - `$HOME/.rbenv/shims/rubocop` + - or the locations in your `PATH`. + + “Reformat Document” prefers [RVM][] install locations of `rubocop` for all of the applicable options above. + +[Bundler]: https://bundler.io +[RVM]: https://rvm.io \ No newline at end of file diff --git a/Support/lib/executable.rb b/Support/lib/executable.rb new file mode 100644 index 0000000..80a1383 --- /dev/null +++ b/Support/lib/executable.rb @@ -0,0 +1,105 @@ +require 'shellwords' + +module Executable + class NotFound < RuntimeError; end + + class << self + # Try to find the Ruby executable `name`. Return an array containing the + # command(s) needed to run the executable. If the executable could not be + # found, `Executable::NotFound` is raised with a message describing the + # problem. + # + # Typical usage looks like this: + # + # Dir.chdir(ENV['TM_PROJECT_DIRECTORY']) if ENV['TM_PROJECT_DIRECTORY'] + # begin + # executable = Executable.find('rspec') + # system(*executable, '--some', '--additional', 'args') + # rescue Executable::NotFound => e + # # Executable not found, so use fallback / display alert / … + # # `e.message` contains detailed error message. + # end + # + # To use this functionality in other bundles, simply declare a dependency on + # the Ruby bundle in the bundle’s `info.plist` and then do `require + # "#{ENV['TM_RUBY_BUNDLE_SUPPORT']}/lib/executable"`. See the RSpec bundle + # for an example: + # + # * https://github.com/rspec/rspec.tmbundle/blob/aa50ab/info.plist#L224-L232 + # * https://github.com/rspec/rspec.tmbundle/blob/aa50ab/Support/lib/rspec/mate/runner.rb#L8 + # + # Supports the following cases: + # + # 1. If an appropriate `TM_*` environment variable is present and points to + # an executable file, its value is returned. (The name of the environment + # variable is automatically derived from the executable name, eg. `rspec` + # → `TM_RSPEC` etc. Alternatively, you can use the `env_var` argument + # to explicitly specify the name.) + # 2. If a binstub (`bin/name`) exists, it is returned. + # 3. If a Gemfile.lock exists and has an entry for `name`, `[bundle exec + # name]` is returned. + # 4. If `name` is found in the search path, it is returned. (Special case: + # If `name` looks like an rbenv shim, also check if the executable has + # been installed for the current Ruby version.) + # + # Both RVM and rbenv are supported, too: + # + # * If RVM is installed, the executable will be run via a small wrapper + # shell script that sets up RVM correctly before running the executable. + # (Note that this is NOT the case if an appropriate `TM_*` environment + # variable is present: In this case, the value of the environment variable + # is returned unchanged. ) + # + # * rbenv just works out of the box as long as your PATH (inside TextMate) + # is setup to contain `~/.rbenv/shims`. + # + def find(name, env_var = nil) + # Safeguard against invalid names so that we don’t need to care about + # shell escaping later on + raise ArgumentError, "Invalid characters found in '#{name}'" unless name =~ /\A[\w_-]+\z/ + + env_var ||= 'TM_' + name.gsub(/\W+/, '_').upcase + prefix = determine_rvm_prefix || [] + if (cmd = ENV[env_var]) && cmd != '' + cmd = cmd.shellsplit + if system('which', '-s', cmd[0]) + cmd + else + raise NotFound, "#{env_var} is set to '#{cmd}', but this does not seem to exist." + end + + elsif File.exist?("bin/#{name}") + prefix + ["bin/#{name}"] + + elsif File.exist?('Gemfile.lock') && File.read('Gemfile.lock') =~ /^ #{name} / + prefix + %W(bundle exec #{name}) + + elsif (path = `#{prefix.map(&:shellescape).join(' ')} which #{name}`.chomp) != '' + # rbenv installs shims that are present even if the command has not been + # installed for the current Ruby version, so we need to also check `rbenv + # which` in this case. + if path.include?('rbenv/shims') && !system("rbenv which #{name} &>/dev/null") + raise NotFound, "rbenv reports that '#{name}' is not installed for the current Ruby version." + else + prefix + [name] + end + + else + raise NotFound, "Could not find executable '#{name}'." + end + end + + private + + # Return appropriate prefix for running commands via RVM if RVM is installed + # and the current directory contains an RVM project file. + def determine_rvm_prefix + rvm = "#{ENV['HOME']}/.rvm/bin/rvm" + %W(#{ENV['TM_BUNDLE_SUPPORT']}/bin/rvm_wrapper) if File.exist?(rvm) + end + + def ruby_version_in_gemfile? + File.exist?('Gemfile.lock') && File.read('Gemfile.lock') =~ /^RUBY_VERSION/ + end + end +end diff --git a/Support/lib/rubocop.rb b/Support/lib/rubocop.rb new file mode 100644 index 0000000..2ad630b --- /dev/null +++ b/Support/lib/rubocop.rb @@ -0,0 +1,83 @@ +# rubocop: disable AsciiComments +# rubocop: disable Style/HashSyntax + +# -- Imports ------------------------------------------------------------------- + +require ENV['TM_BUNDLE_SUPPORT'] + '/lib/executable' + +require ENV['TM_SUPPORT_PATH'] + '/lib/exit_codes' +require ENV['TM_SUPPORT_PATH'] + '/lib/progress' +require ENV['TM_SUPPORT_PATH'] + '/lib/tm/detach' +require ENV['TM_SUPPORT_PATH'] + '/lib/tm/save_current_document' + +# -- Module -------------------------------------------------------------------- + +# This module allows you to reformat files via RuboCop. +module RuboCop + class << self + # This function reformats the current TextMate document using RuboCop. + # + # It works both on saved and unsaved files: + # + # 1. In the case of an unsaved files this method will stall until RuboCop + # fixed the file. While this process takes place the method displays a + # progress bar. + # + # 2. If the current document is a file saved somewhere on your disk, then + # the method will not wait until RuboCop is finished. Instead it will run + # RuboCop in the background. This has the advantage, that you can still + # work inside TextMate, while RuboCop works on the document. + # + # After RuboCop finished reformatting the file, the method will inform you + # – via a tooltip – about the problems RuboCop found in the *previous* + # version of the document. + def reformat + unsaved_file = true unless ENV['TM_FILEPATH'] + TextMate.save_if_untitled('rb') + format_file(locate_rubocop, unsaved_file) + end + + private + + def locate_rubocop + Dir.chdir(ENV['TM_PROJECT_DIRECTORY'] || + File.dirname(ENV['TM_FILEPATH'].to_s)) + begin + Executable.find('rubocop').join ' ' + rescue Executable::NotFound => error + return 'rubocop' if File.executable?(`which rubocop`.rstrip) + TextMate.exit_show_tool_tip(error.message) + end + end + + def format_file(rubocop, unsaved_file) + aha = `which aha`.rstrip.match(/.+/) + output_format = aha ? :html : :text + command = "#{rubocop} -a \"$TM_FILEPATH\" $TM_RUBOCOP_OPTIONS \ + #{'--color | aha' if aha} 2>&1" + if unsaved_file + format_unsaved(command, output_format) + else + format_saved(command, output_format) + end + end + + def format_unsaved(rubocop_command, output_format) + output, success = TextMate.call_with_progress( + :title => '🤖 RuboCop', :summary => 'Reformatting File' + ) do + [`#{rubocop_command}`, $CHILD_STATUS.success?] + end + TextMate.exit_show_tool_tip(output) unless success + TextMate::UI.tool_tip(output, :format => output_format) + TextMate.exit_replace_document(File.read(ENV['TM_FILEPATH'])) + end + + def format_saved(rubocop_command, output_format) + TextMate.detach do + output = `#{rubocop_command}` + TextMate::UI.tool_tip(output, :format => output_format) + end + end + end +end \ No newline at end of file diff --git a/Support/test/fixtures/.tm_properties b/Support/test/fixtures/.tm_properties new file mode 100644 index 0000000..d1d2c06 --- /dev/null +++ b/Support/test/fixtures/.tm_properties @@ -0,0 +1 @@ +include = "{$include,.rvm}" diff --git a/Support/test/fixtures/bin/rspec b/Support/test/fixtures/bin/rspec new file mode 100755 index 0000000..d738b23 --- /dev/null +++ b/Support/test/fixtures/bin/rspec @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/Support/test/fixtures/bin/sample-executable b/Support/test/fixtures/bin/sample-executable new file mode 100755 index 0000000..bab677a --- /dev/null +++ b/Support/test/fixtures/bin/sample-executable @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +# noop \ No newline at end of file diff --git a/Support/test/fixtures/fake_rbenv/rbenv b/Support/test/fixtures/fake_rbenv/rbenv new file mode 100755 index 0000000..0e7b4a2 --- /dev/null +++ b/Support/test/fixtures/fake_rbenv/rbenv @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +if [[ $1 == "which" ]]; then + echo "rbenv: $2: command not found" + exit 127 +fi diff --git a/Support/test/fixtures/fake_rbenv/shims/rbenv_installed_shim b/Support/test/fixtures/fake_rbenv/shims/rbenv_installed_shim new file mode 100755 index 0000000..08b8b25 --- /dev/null +++ b/Support/test/fixtures/fake_rbenv/shims/rbenv_installed_shim @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +# do nothing ... diff --git a/Support/test/fixtures/fake_rvm_home/.rvm/bin/rvm b/Support/test/fixtures/fake_rvm_home/.rvm/bin/rvm new file mode 100755 index 0000000..d68a5d5 --- /dev/null +++ b/Support/test/fixtures/fake_rvm_home/.rvm/bin/rvm @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Fake RVM stub to be used in tests. Serves a single purpose: +# +# * If invoked as `rvm . do which [-s] …` it pretends that an executable +# named `sample_executable_from_rvm` is available in the search path. +# (Optional `-s` behaves just like in the original `which` command on BSD / +# MacOS.) + +if [[ "$1 $2 $3" == ". do which" ]]; then + if [[ $4 == "-s" && $5 == "sample_executable_from_rvm" ]]; then + exit 0 + elif [[ $4 == "sample_executable_from_rvm" ]]; then + echo "/some/fake/path/to/sample_executable_from_rvm" + else + exit 1 + fi + +else + >&2 echo "You tried to make this fake RVM stub do something it does not understand!: $*" + exit 99 + +fi \ No newline at end of file diff --git a/Support/test/fixtures/sample_project/Gemfile b/Support/test/fixtures/sample_project/Gemfile new file mode 100644 index 0000000..4c96875 --- /dev/null +++ b/Support/test/fixtures/sample_project/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'rubocop' +gem 'rspec' diff --git a/Support/test/fixtures/sample_project/Gemfile.lock b/Support/test/fixtures/sample_project/Gemfile.lock new file mode 100644 index 0000000..66c5e15 --- /dev/null +++ b/Support/test/fixtures/sample_project/Gemfile.lock @@ -0,0 +1,40 @@ +GEM + remote: https://rubygems.org/ + specs: + ast (2.3.0) + diff-lcs (1.2.5) + parser (2.3.1.2) + ast (~> 2.2) + powerpack (0.1.1) + rainbow (2.1.0) + rspec (3.5.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-core (3.5.2) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + rubocop (0.42.0) + parser (>= 2.3.1.1, < 3.0) + powerpack (~> 0.1) + rainbow (>= 1.99.1, < 3.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.8.1) + unicode-display_width (1.1.0) + +PLATFORMS + ruby + +DEPENDENCIES + rspec + rubocop + +BUNDLED WITH + 1.12.5 diff --git a/Support/test/fixtures/sample_project/bin/rspec b/Support/test/fixtures/sample_project/bin/rspec new file mode 100755 index 0000000..d738b23 --- /dev/null +++ b/Support/test/fixtures/sample_project/bin/rspec @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/Support/test/fixtures/sample_project/other/rspec b/Support/test/fixtures/sample_project/other/rspec new file mode 100755 index 0000000..d738b23 --- /dev/null +++ b/Support/test/fixtures/sample_project/other/rspec @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/Support/test/test_executable.rb b/Support/test/test_executable.rb new file mode 100644 index 0000000..ef12d40 --- /dev/null +++ b/Support/test/test_executable.rb @@ -0,0 +1,171 @@ +require 'minitest/autorun' +require 'shellwords' +require "#{__dir__}/../lib/executable" + +class TestExecutableFind < Minitest::Test + def setup + Dir.chdir("#{__dir__}/fixtures/sample_project") + + # Set $HOME to a directory controlled by us to make sure `$HOME/.rvm` does + # not exist even if the user running these tests has rvm actually installed. + # Also, clear out all `TM_*` env vars so they won’t interfere with our + # tests. + @original_env = ENV.to_h + ENV['HOME'] = "#{__dir__}/fixtures/sample_project" + ENV.delete_if{ |name, _value| name.start_with?('TM_') } + + # $TM_BUNDLE_SUPPORT is needed by `Executable.determine_rvm_prefix` + ENV['TM_BUNDLE_SUPPORT'] = File.realpath("#{__dir__}/..") + @rvm_prefix = "#{ENV['TM_BUNDLE_SUPPORT']}/bin/rvm_wrapper" + end + + def teardown + ENV.replace(@original_env) + end + + def with_env(env_vars) + original_env = ENV.to_h + ENV.update(env_vars) + yield + ensure + ENV.replace(original_env) + end + + # Set $HOME to a directory containing `.rvm/bin/rvm` (because this is what + # `Executable` checks to determine if RVM is installed) + def with_rvm_installed + with_env('HOME' => "#{__dir__}/fixtures/fake_rvm_home") do + yield + end + end + + + def test_validate_name + assert_raises(ArgumentError){ Executable.find('foo bar') } + assert_raises(ArgumentError){ Executable.find('') } + assert_raises(ArgumentError){ Executable.find(nil) } + assert_raises(ArgumentError){ Executable.find('special;characters') } + assert_raises(ArgumentError){ Executable.find('not\ ok') } + assert_raises(ArgumentError){ Executable.find('"quoted"') } + end + + def test_use_env_var + rspec_path = "#{__dir__}/fixtures/sample_project/other/rspec" + with_env('TM_RSPEC' => rspec_path.shellescape) do + assert_equal [rspec_path], Executable.find('rspec') + end + end + + # Even if RVM is installed, if an env var is set for the executable it should + # be used unchanged (i.e. it should not be prefixed with the rvm wrapper + # script.) + def test_use_env_var_with_rvm + rspec_path = "#{__dir__}/fixtures/sample_project/other/rspec" + with_rvm_installed do + with_env('TM_RSPEC' => rspec_path.shellescape) do + assert_equal [rspec_path], Executable.find('rspec') + end + end + end + + def test_use_custom_env_var + rspec_path = "#{__dir__}/fixtures/sample_project/other/rspec" + with_env('TM_RSPEC' => rspec_path.shellescape) do + assert_equal [rspec_path], Executable.find('rspec-special', 'TM_RSPEC') + end + end + + # Setting TM_FOO to eg. `bundle exec foo` should be possible, too. + def test_use_env_var_with_executable_with_spaces + with_env('PATH' => "#{__dir__}/fixtures/bin:#{ENV['PATH']}", 'TM_SAMPLE' => 'sample-executable with options') do + assert_equal %w(sample-executable with options), Executable.find('sample') + end + end + + def test_use_env_var_with_missing_executable + with_env('TM_NONEXISTING_EXECUTABLE' => 'nonexisting-executable') do + assert_raises(Executable::NotFound){ Executable.find('nonexisting-executable', 'TM_NONEXISTING_EXECUTABLE') } + end + end + + def test_find_binstub + assert_equal %w(bin/rspec), Executable.find('rspec') + end + + def test_find_binstub_with_rvm + with_rvm_installed do + assert_equal %W(#{@rvm_prefix} bin/rspec), Executable.find('rspec') + end + end + + def test_find_in_gemfile + assert_equal %w(bundle exec rubocop), Executable.find('rubocop') + end + + def test_find_in_gemfile_with_rvm + with_rvm_installed do + assert_equal %W(#{@rvm_prefix} bundle exec rubocop), Executable.find('rubocop') + end + end + + def test_find_in_path + # Of course `ls` is not a Ruby executable, but for this test it makes no difference + assert_equal %w(ls), Executable.find('ls') + end + + def test_find_in_path_with_rvm + with_rvm_installed do + # Of course `ls` is not a Ruby executable, but for this test it makes no difference + assert_equal %W(#{@rvm_prefix} ls), Executable.find('ls') + end + end + + def test_missing_executable + assert_raises(Executable::NotFound){ Executable.find('nonexisting-executable') } + end + + def test_missing_executable_with_rvm + with_rvm_installed do + assert_raises(Executable::NotFound){ Executable.find('nonexisting-executable') } + end + end + + def test_missing_executable_with_rbenv_and_shim + # Setup an environment where our fake implementation of `rbenv` is in the + # path, as well as our fake shim (`rbenv_installed_shim`). Note that the + # fake implentation of `rbenv` will return an “not found” error if run + # as `rbenv which rbenv_installed_shim` + with_env('PATH' => "#{__dir__}/fixtures/fake_rbenv:#{__dir__}/fixtures/fake_rbenv/shims:#{ENV['PATH']}") do + assert_equal "#{__dir__}/fixtures/fake_rbenv/rbenv", `which rbenv`.chomp + assert system('which -s rbenv_installed_shim') + + # Now for the actual test + assert_raises(Executable::NotFound){ Executable.find('rbenv_installed_shim') } + end + end + + def test_find_precedence + # Make sure we start with a directory with no Gemfile or binstubs, and also with no environment variable. + Dir.mktmpdir do |dir| + Dir.chdir(dir) + + # Using search path has lowest precedence + with_env('PATH' => "#{__dir__}/fixtures/bin:#{ENV['PATH']}") do + assert_equal %w(rspec), Executable.find('rspec') + + # Using a Gemfile comes next + FileUtils.cp(Dir.glob("#{__dir__}/fixtures/sample_project/Gemfile.*"), dir) + assert_equal %w(bundle exec rspec), Executable.find('rspec') + + # Using a binstub has an even higher precedence + FileUtils.cp_r("#{__dir__}/fixtures/sample_project/bin", dir) + assert_equal %w(bin/rspec), Executable.find('rspec') + + # Finally, using an environment variable has highest precedence + with_env('TM_RSPEC' => 'ls') do + assert_equal %w(ls), Executable.find('rspec') + end + end + end + end +end diff --git a/Syntaxes/Gemfile.tmLanguage b/Syntaxes/Gemfile.tmLanguage new file mode 100644 index 0000000..80cab23 --- /dev/null +++ b/Syntaxes/Gemfile.tmLanguage @@ -0,0 +1,48 @@ + + + + + fileTypes + + Gemfile + + hideFromUser + + name + Gemfile + patterns + + + include + source.ruby + + + begin + \b(?<!\.|::)(gem|git|group|platforms|ruby|source)\b(?![?!]) + captures + + 1 + + name + keyword.other.special-method.ruby.gemfile + + + end + $|(?=#|}) + name + meta.declaration.ruby.gemfile + patterns + + + include + $self + + + + + scopeName + source.ruby.gemfile + uuid + 410F8BB5-7543-4081-A38D-3B69CA92ACE9 + + diff --git a/Syntaxes/Ruby.plist b/Syntaxes/Ruby.plist index 5f24694..6aac22a 100644 --- a/Syntaxes/Ruby.plist +++ b/Syntaxes/Ruby.plist @@ -7,7 +7,7 @@ TODO: unresolved issues text: - "p << end + "p <<end print me! end" symptoms: @@ -27,13 +27,6 @@ symtoms: From Programming Ruby p306; should be a non-interpolated heredoc. - text: - "a\332a" - symptoms: - '\332' is not recognized as slash3.. which should be octal 332. - solution: - plain regexp.. should be easy. - text: val?(a):p(b) val?'a':'b' @@ -55,20 +48,55 @@ fcgi gemspec irbrc - capfile + Capfile ru prawn - Gemfile + Cheffile Guardfile + Hobofile Vagrantfile + .vagrantplugins Appraisals Rantfile Berksfile Berksfile.lock Thorfile + Puppetfile + arb + Dangerfile + Brewfile + Fastfile + Appfile + Deliverfile + Matchfile + Scanfile + Snapfile + Gymfile + jb firstLineMatch - ^#!/.*\bruby + (?x) +# Hashbang +^\#!.*(?:\s|\/) +(?:ruby[\.\d]*|macruby|rake|jruby|rbx|ruby_executable_hooks) +(?:$|\s) +| +# Modeline +(?i: + # Emacs + -\*-(?:\s*(?=[^:;\s]+\s*-\*-)|(?:.*?[;\s]|(?<=-\*-))mode\s*:\s*) + ruby + (?=[\s;]|(?<![-*])-\*-).*?-\*- + | + # Vim + (?:(?:\s|^)vi(?:m[<=>]?\d+|m)?|\sex) + (?=:(?=\s*set?\s[^\n:]+:)|:(?!\s*set?\s)) + (?:(?:\s|\s*:\s*)\w*(?:\s*=(?:[^\n\\\s]|\\.)*)?)* + [\s:] + (?:filetype|ft|syntax)\s*= + ruby + (?=\s|:|$) +) keyEquivalent ^~R name @@ -88,6 +116,11 @@ name entity.name.type.class.ruby + 3 + + name + keyword.operator.other.ruby + 4 name @@ -96,21 +129,16 @@ 5 name - punctuation.separator.inheritance.ruby + keyword.operator.other.ruby 6 name variable.other.object.ruby - 7 - - name - punctuation.definition.variable.ruby - match - ^\s*(class)\s+(([.a-zA-Z0-9_:]+(\s*(<)\s*[.a-zA-Z0-9_:]+)?)|((<<)\s*[.a-zA-Z0-9_:]+)) + ^\s*(class)\s+(?:([.a-zA-Z0-9_:]+)(?:\s*(<)\s*([.a-zA-Z0-9_:]+))?|(<<)\s*([.a-zA-Z0-9_:]+)) name meta.class.ruby @@ -215,7 +243,7 @@ comment contextual smart pair support for block parameters match - (?<!\.)\bdo\b\s* + (?<!\.)\bdo\b name keyword.control.start-block.ruby @@ -228,18 +256,8 @@ meta.syntax.ruby.start-block - comment - as above, just doesn't need a 'end' and does a logic operation - match - (?<!\.)\b(and|not|or)\b - name - keyword.operator.logical.ruby - - - comment - just as above but being not a logical operation match - (?<!\.)\b(alias|alias_method|break|next|redo|retry|return|super|undef|yield)\b(?![?!])|\bdefined\?|\bblock_given\? + (?<!\.)\b(alias|alias_method|block_given[?]|break|defined[?]|iterator[?]|next|redo|retry|return|super|undef|yield)(\b|(?<=[?]))(?![?!]) name keyword.control.pseudo-method.ruby @@ -251,21 +269,27 @@ match - \b(__(FILE|LINE)__|self)\b(?![?!]) + \b(__(FILE|LINE)__)\b(?![?!]) name variable.language.ruby + + match + \b(self)\b(?![?!]) + name + variable.language.self.ruby + comment everything being a method but having a special function is a.. match - \b(initialize|new|loop|include|extend|prepend|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|module_function|public|protected)\b(?![?!]) + \b(initialize|new|loop|include|extend|prepend|fail|raise|attr_reader|attr_writer|attr_accessor|attr|catch|throw|private|private_class_method|module_function|public|protected|refine|using)\b(?![?!]) name keyword.other.special-method.ruby begin - \b(require|require_relative|gem)\b + \b(?<!\.|::)(require|require_relative)\b captures 1 @@ -338,7 +362,7 @@ match - (\$)(!|@|&|`|'|\+|\d+|~|=|/|\\|,|;|\.|<|>|_|\*|\$|\?|:|"|-[0adFiIlpv]) + (\$)(!|@|&|`|'|\+|\d+|~|=|/|\\|,|;|\.|<|>|_|\*|\$|\?|:|"|-[0adFiIlpvw]) name variable.other.readwrite.global.pre-defined.ruby @@ -373,7 +397,13 @@ match - \b[A-Z]\w*\b + \b(abort|at_exit|autoload[?]?|binding|callcc|caller|caller_locations|chomp|chop|eval|exec|exit|exit!|fork|format|gets|global_variables|gsub|lambda|load|local_variables|open|p|print|printf|proc|putc|puts|rand|readline|readlines|select|set_trace_func|sleep|spawn|sprintf|srand|sub|syscall|system|test|trace_var|trap|untrace_var|warn)(\b|(?<=[?!]))(?![?!]) + name + support.function.kernel.ruby + + + match + \b[_A-Z]\w*\b name variable.other.constant.ruby @@ -384,7 +414,7 @@ (?<=^|\s)(def)\s+ # the def keyword ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method + |===?|!=|!~|>[>=]?|<=>|<[<=]?|[%&`/\|^]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method \s*(\() # the openning parenthesis for arguments beginCaptures @@ -423,7 +453,7 @@ begin - (?![\s,)]) + (?=[&*_a-zA-Z]) end (?=[,)]) patterns @@ -437,13 +467,46 @@ storage.type.variable.ruby 2 + + name + constant.other.symbol.hashkey.parameter.function.ruby + + 3 + + name + punctuation.definition.constant.ruby + + 4 name variable.parameter.function.ruby match - \G([&*]?)([_a-zA-Z][_a-zA-Z0-9]*) + \G([&*]?)(?:([_a-zA-Z]\w*(:))|([_a-zA-Z]\w*)) + + + begin + \( + captures + + 0 + + name + punctuation.section.function.ruby + + + comment + Prevent end pattern of parent rule from ending prematurely. + end + \) + patterns + + + include + $self + + include @@ -460,7 +523,7 @@ (?<=^|\s)(def)\s+ # the def keyword ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method + |===?|!=|!~|>[>=]?|<=>|<[<=]?|[%&`/\|^]|\*\*?|=?~|[-+]@?|\[\]=?) ) # …or an operator method [ \t] # the space separating the arguments (?=[ \t]*[^\s#;]) # make sure arguments and not a comment follow @@ -498,11 +561,26 @@ 1 name - punctuation.definition.variable.ruby + storage.type.variable.ruby + + 2 + + name + constant.other.symbol.hashkey.parameter.function.ruby + + 3 + + name + punctuation.definition.constant.ruby + + 4 + + name + variable.parameter.function.ruby match - \G([&*]?)[_a-zA-Z][_a-zA-Z0-9]* + \G([&*]?)(?:([_a-zA-Z]\w*(:))|([_a-zA-Z]\w*)) name variable.parameter.function.ruby @@ -537,7 +615,7 @@ ( \s+ # an optional group of whitespace followed by… ( (?>[a-zA-Z_]\w*(?>\.|::))? # a method name prefix (?>[a-zA-Z_]\w*(?>[?!]|=(?!>))? # the method name - |===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?) ) )? # …or an operator method + |===?|!=|!~|>[>=]?|<=>|<[<=]?|[%&`/\|^]|\*\*?|=?~|[-+]@?|\[\]=?) ) )? # …or an operator method name meta.function.method.without-arguments.ruby @@ -734,205 +812,8 @@ - begin - %x\{ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \} - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_curly_i - - - - - begin - %x\[ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \] - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_brackets_i - - - - - begin - %x\< - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \> - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_ltgt_i - - - - - begin - %x\( - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \) - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_parens_i - - - - - begin - %x([\W_]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - execute string (allow for interpolation) - end - \1 - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.interpolated.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - + include + #percent_literals begin @@ -999,763 +880,617 @@ - begin - %r\{ - beginCaptures + captures - 0 + 1 name - punctuation.definition.string.begin.ruby + punctuation.definition.constant.ruby comment - regular expressions (literal) - end - \}[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + symbols + match + (?<!:)(:)(?>[a-zA-Z_]\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<=>|<[<=]?|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?|(@@?|\$)[a-zA-Z_]\w*) name - string.regexp.mod-r.ruby - patterns - - - include - #regex_sub - - - include - #nest_curly_r - - + constant.other.symbol.ruby begin - %r\[ - beginCaptures + ^=begin + captures 0 name - punctuation.definition.string.begin.ruby + punctuation.definition.comment.ruby comment - regular expressions (literal) + multiline comments end - \][eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + ^=end name - string.regexp.mod-r.ruby - patterns - - - include - #regex_sub - - - include - #nest_brackets_r - - + comment.block.documentation.ruby begin - %r\( + (^[ \t]+)?(?=#) beginCaptures - 0 + 1 name - punctuation.definition.string.begin.ruby + punctuation.whitespace.comment.leading.ruby - comment - regular expressions (literal) end - \)[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.regexp.mod-r.ruby + (?!\G) patterns - include - #regex_sub - - - include - #nest_parens_r + begin + # + beginCaptures + + 0 + + name + punctuation.definition.comment.ruby + + + end + \n + name + comment.line.number-sign.ruby - begin - %r\< - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - comment - regular expressions (literal) - end - \>[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + + matches questionmark-letters. + + examples (1st alternation = hex): + ?\x1 ?\x61 + + examples (2nd alternation = octal): + ?\0 ?\07 ?\017 + + examples (3rd alternation = escaped): + ?\n ?\b + + examples (4th alternation = meta-ctrl): + ?\C-a ?\M-a ?\C-\M-\C-\M-a + + examples (4th alternation = normal): + ?a ?A ?0 + ?* ?" ?( + ?. ?# + + + the negative lookbehind prevents against matching + p(42.tainted?) + + match + (?<!\w)\?(\\(x\h{1,2}(?!\h)\b|0[0-7]{0,2}(?![0-7])\b|[^x0MC])|(\\[MC]-)+\w|[^\s\\]) name - string.regexp.mod-r.ruby - patterns - - - include - #regex_sub - - - include - #nest_ltgt_r - - + constant.numeric.ruby begin - %r([\W_]) - beginCaptures + ^__END__\n + captures 0 name - punctuation.definition.string.begin.ruby + string.unquoted.program-block.ruby comment - regular expressions (literal) + __END__ marker + contentName + text.plain end - \1[eimnosux]* - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.regexp.mod-r.ruby + (?=not)impossible patterns - include - #regex_sub + begin + (?=<?xml|<(?i:html\b)|!DOCTYPE (?i:html\b)) + end + (?=not)impossible + name + text.html.embedded.ruby + patterns + + + include + text.html.basic + + begin - %[QWSR]?\( - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<[-~]("?)((?:[_\w]+_|)HTML)\b\1)) comment - literal capable of interpolation () + Heredoc with embedded html end - \) - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.upper.ruby + meta.embedded.block.html patterns - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_parens_i + begin + (?><<[-~]("?)((?:[_\w]+_|)HTML)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + text.html + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + + name + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + text.html.basic + + + include + #escaped_char + + begin - %[QWSR]?\[ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<[-~]("?)((?:[_\w]+_|)XML)\b\1)) comment - literal capable of interpolation [] + Heredoc with embedded xml end - \] - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.upper.ruby + meta.embedded.block.xml patterns - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_brackets_i + begin + (?><<[-~]("?)((?:[_\w]+_|)XML)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + text.xml + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + + name + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + text.xml + + + include + #escaped_char + + begin - %[QWSR]?\< - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<[-~]("?)((?:[_\w]+_|)SQL)\b\1)) comment - literal capable of interpolation <> + Heredoc with embedded sql end - \> - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.upper.ruby + meta.embedded.block.sql patterns - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_ltgt_i + begin + (?><<[-~]("?)((?:[_\w]+_|)SQL)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.sql + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + + name + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.sql + + + include + #escaped_char + + begin - %[QWSR]?\{ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<[-~]("?)((?:[_\w]+_|)CSS)\b\1)) comment - literal capable of interpolation -- {} + Heredoc with embedded css end - \} - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.double.ruby.mod + meta.embedded.block.css patterns - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_curly_i + begin + (?><<[-~]("?)((?:[_\w]+_|)CSS)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.css + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + + name + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.css + + + include + #escaped_char + + begin - %[QWSR]([\W_]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<[-~]("?)((?:[_\w]+_|)CPP)\b\1)) comment - literal capable of interpolation -- wildcard + Heredoc with embedded c++ end - \1 - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.upper.ruby + meta.embedded.block.c++ patterns - include - #interpolated_ruby - - - include - #escaped_char + begin + (?><<[-~]("?)((?:[_\w]+_|)CPP)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.c++ + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + + name + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.c++ + + + include + #escaped_char + + begin - %([^\w\s=]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal capable of interpolation -- wildcard - end - \1 - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.other.ruby - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - %[qws]\( - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<[-~]("?)((?:[_\w]+_|)C)\b\1)) comment - literal incapable of interpolation -- () + Heredoc with embedded c end - \) - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.lower.ruby + meta.embedded.block.c patterns - match - \\\)|\\\\ + begin + (?><<[-~]("?)((?:[_\w]+_|)C)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.c + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - constant.character.escape.ruby - - - include - #nest_parens + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.c + + + include + #escaped_char + + begin - %[qws]\< - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<[-~]("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1)) comment - literal incapable of interpolation -- <> + Heredoc with embedded javascript end - \> - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.lower.ruby + meta.embedded.block.js patterns - match - \\\>|\\\\ + begin + (?><<[-~]("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.js + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - constant.character.escape.ruby - - - include - #nest_ltgt + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.js + + + include + #escaped_char + + begin - %[qws]\[ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<[-~]("?)((?:[_\w]+_|)JQUERY)\b\1)) comment - literal incapable of interpolation -- [] + Heredoc with embedded jQuery javascript end - \] - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.lower.ruby + meta.embedded.block.js.jquery patterns - match - \\\]|\\\\ + begin + (?><<[-~]("?)((?:[_\w]+_|)JQUERY)\b\1) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + contentName + source.js.jquery + end + \s*\2$\n? + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - constant.character.escape.ruby - - - include - #nest_brackets + string.unquoted.heredoc.ruby + patterns + + + include + #heredoc + + + include + #interpolated_ruby + + + include + source.js.jquery + + + include + #escaped_char + + begin - %[qws]\{ - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - + (?=(?><<[-~]("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1)) comment - literal incapable of interpolation -- {} + Heredoc with embedded shell end - \} - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + (?!\G) name - string.quoted.other.literal.lower.ruby - patterns - - - match - \\\}|\\\\ - name - constant.character.escape.ruby - - - include - #nest_curly - - - - - begin - %[qws]([\W_]) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - literal incapable of interpolation -- wildcard - end - \1 - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.quoted.other.literal.lower.ruby - patterns - - - comment - Cant be named because its not neccesarily an escape. - match - \\. - - - - - captures - - 1 - - name - punctuation.definition.constant.ruby - - - comment - symbols - match - (?<!:)(:)(?>[a-zA-Z_]\w*(?>[?!]|=(?![>=]))?|===?|>[>=]?|<[<=]?|<=>|[%&`/\|]|\*\*?|=?~|[-+]@?|\[\]=?|@@?[a-zA-Z_]\w*) - name - constant.other.symbol.ruby - - - begin - ^=begin - captures - - 0 - - name - punctuation.definition.comment.ruby - - - comment - multiline comments - end - ^=end - name - comment.block.documentation.ruby - - - begin - (^[ \t]+)?(?=#) - beginCaptures - - 1 - - name - punctuation.whitespace.comment.leading.ruby - - - end - (?!\G) - patterns - - - begin - # - beginCaptures - - 0 - - name - punctuation.definition.comment.ruby - - - end - \n - name - comment.line.number-sign.ruby - - - - - comment - - matches questionmark-letters. - - examples (1st alternation = hex): - ?\x1 ?\x61 - - examples (2nd alternation = octal): - ?\0 ?\07 ?\017 - - examples (3rd alternation = escaped): - ?\n ?\b - - examples (4th alternation = meta-ctrl): - ?\C-a ?\M-a ?\C-\M-\C-\M-a - - examples (4th alternation = normal): - ?a ?A ?0 - ?* ?" ?( - ?. ?# - - - the negative lookbehind prevents against matching - p(42.tainted?) - - match - (?<!\w)\?(\\(x\h{1,2}(?!\h)\b|0[0-7]{0,2}(?![0-7])\b|[^x0MC])|(\\[MC]-)+\w|[^\s\\]) - name - constant.numeric.ruby - - - begin - ^__END__\n - captures - - 0 - - name - string.unquoted.program-block.ruby - - - comment - __END__ marker - contentName - text.plain - end - (?=not)impossible - patterns - - - begin - (?=<?xml|<(?i:html\b)|!DOCTYPE (?i:html\b)) - end - (?=not)impossible - name - text.html.embedded.ruby - patterns - - - include - text.html.basic - - - - - - - begin - (?=(?><<-("?)((?:[_\w]+_|)HTML)\b\1)) - comment - Heredoc with embedded html - end - (?!\G) - name - meta.embedded.block.html + meta.embedded.block.shell patterns begin - (?><<-("?)((?:[_\w]+_|)HTML)\b\1) + (?><<[-~]("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1) beginCaptures 0 @@ -1765,7 +1500,7 @@ contentName - text.html + source.shell end \s*\2$\n? endCaptures @@ -1790,7 +1525,7 @@ include - text.html.basic + source.shell include @@ -1802,18 +1537,18 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)SQL)\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)LUA)\b\1)) comment - Heredoc with embedded sql + Heredoc with embedded lua end (?!\G) name - meta.embedded.block.sql + meta.embedded.block.lua patterns begin - (?><<-("?)((?:[_\w]+_|)SQL)\b\1) + (?><<[-~]("?)((?:[_\w]+_|)LUA)\b\1) beginCaptures 0 @@ -1823,7 +1558,7 @@ contentName - source.sql + source.lua end \s*\2$\n? endCaptures @@ -1848,7 +1583,7 @@ include - source.sql + source.lua include @@ -1860,18 +1595,18 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)CSS)\b\1)) + (?=(?><<[-~]("?)((?:[_\w]+_|)RUBY)\b\1)) comment - Heredoc with embedded css + Heredoc with embedded ruby end (?!\G) name - meta.embedded.block.css + meta.embedded.block.ruby patterns begin - (?><<-("?)((?:[_\w]+_|)CSS)\b\1) + (?><<[-~]("?)((?:[_\w]+_|)RUBY)\b\1) beginCaptures 0 @@ -1881,7 +1616,7 @@ contentName - source.css + source.ruby end \s*\2$\n? endCaptures @@ -1906,7 +1641,7 @@ include - source.css + source.ruby include @@ -1916,20 +1651,20 @@ - - begin - (?=(?><<-("?)((?:[_\w]+_|)CPP)\b\1)) + + begin + (?=(?><<-("?)((?:[_\w]+_|)GRAPHQL)\b\1)) comment - Heredoc with embedded c++ + Heredoc with embedded GraphQL end (?!\G) name - meta.embedded.block.c++ + meta.embedded.block.graphql patterns begin - (?><<-("?)((?:[_\w]+_|)CPP)\b\1) + (?><<-("?)((?:[_\w]+_|)GRAPHQL)\b\1) beginCaptures 0 @@ -1939,7 +1674,7 @@ contentName - source.c++ + source.graphql end \s*\2$\n? endCaptures @@ -1964,7 +1699,7 @@ include - source.c++ + source.graphql include @@ -1976,1069 +1711,2484 @@ begin - (?=(?><<-("?)((?:[_\w]+_|)C)\b\1)) - comment - Heredoc with embedded c + (?>[=,]\s*<<(\w+)) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + end - (?!\G) + ^\1$ + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - meta.embedded.block.c + string.unquoted.heredoc.ruby patterns - begin - (?><<-("?)((?:[_\w]+_|)C)\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - contentName - source.c - end - \s*\2$\n? - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - source.c - - - include - #escaped_char - - + include + #heredoc + + + include + #interpolated_ruby + + + include + #escaped_char begin - (?=(?><<-("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1)) + (?><<[-~](\w+)) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + comment - Heredoc with embedded javascript + heredoc with indented terminator end - (?!\G) + \s*\1$ + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - meta.embedded.block.js + string.unquoted.heredoc.ruby patterns - begin - (?><<-("?)((?:[_\w]+_|)(?:JS|JAVASCRIPT))\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - contentName - source.js - end - \s*\2$\n? - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - source.js - - - include - #escaped_char - - + include + #heredoc + + + include + #interpolated_ruby + + + include + #escaped_char begin - (?=(?><<-("?)((?:[_\w]+_|)JQUERY)\b\1)) - comment - Heredoc with embedded jQuery javascript + (?<=\{|do|\{\s|do\s)(\|) + captures + + 1 + + name + punctuation.separator.arguments.ruby + + end - (?!\G) - name - meta.embedded.block.js.jquery + (?<!\|)(\|)(?!\|) patterns - begin - (?><<-("?)((?:[_\w]+_|)JQUERY)\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - contentName - source.js.jquery - end - \s*\2$\n? - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - + include + $self + + + match + [_a-zA-Z][_a-zA-Z0-9]* name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - source.js.jquery - - - include - #escaped_char - - + variable.other.block.ruby + + + match + , + name + punctuation.separator.variable.ruby - begin - (?=(?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1)) + match + => + name + punctuation.separator.key-value + + + match + -> + name + support.function.kernel.lambda.ruby + + + match + <<=|%=|&{1,2}=|\*=|\*\*=|\+=|-=|\^=|\|{1,2}=|<< + name + keyword.operator.assignment.augmented.ruby + + + match + <=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \t])\? + name + keyword.operator.comparison.ruby + + + match + (?<!\.)\b(and|not|or)\b(?![?!]) + name + keyword.operator.logical.ruby + + comment - Heredoc with embedded shell - end - (?!\G) + Make sure this goes after assignment and comparison + match + (?<=^|[ \t])!|&&|\|\||\^ name - meta.embedded.block.shell - patterns - + keyword.operator.logical.ruby + + + captures + + 1 - begin - (?><<-("?)((?:[_\w]+_|)(?:SH|SHELL))\b\1) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - contentName - source.shell - end - \s*\2$\n? - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - source.shell - - - include - #escaped_char - - + punctuation.separator.method.ruby - + + comment + Safe navigation operator - Added in 2.3 + match + (&\.)\s*(?![A-Z]) - begin - (?=(?><<-("?)((?:[_\w]+_|)LUA)\b\1)) - comment - Heredoc with embedded lua - end - (?!\G) + match + (%|&|\*\*|\*|\+|-|/) name - meta.embedded.block.lua + keyword.operator.arithmetic.ruby + + + match + = + name + keyword.operator.assignment.ruby + + + match + \||~|>> + name + keyword.operator.other.ruby + + + match + ; + name + punctuation.separator.statement.ruby + + + match + , + name + punctuation.separator.object.ruby + + + captures + + 1 + + name + punctuation.separator.namespace.ruby + + + comment + Mark as namespace separator if double colons followed by capital letter + match + (::)\s*(?=[A-Z]) + + + captures + + 1 + + name + punctuation.separator.method.ruby + + + comment + Mark as method separator if double colons not followed by capital letter + match + (\.|::)\s*(?![A-Z]) + + + comment + Must come after method and constant separators to prefer double colons + match + : + name + punctuation.separator.other.ruby + + + match + \{ + name + punctuation.section.scope.begin.ruby + + + match + \} + name + punctuation.section.scope.end.ruby + + + match + \[ + name + punctuation.section.array.begin.ruby + + + match + \] + name + punctuation.section.array.end.ruby + + + match + \(|\) + name + punctuation.section.function.ruby + + + repository + + escaped_char + + match + \\(?:[0-7]{1,3}|x[\da-fA-F]{1,2}|.) + name + constant.character.escape.ruby + + heredoc + + begin + ^<<[-~]?\w+ + end + $ + patterns + + + include + $self + + + + interpolated_ruby + patterns begin - (?><<-("?)((?:[_\w]+_|)LUA)\b\1) + #\{ beginCaptures 0 name - punctuation.definition.string.begin.ruby + punctuation.section.embedded.begin.ruby contentName - source.lua + source.ruby end - \s*\2$\n? + (\}) endCaptures 0 name - punctuation.definition.string.end.ruby + punctuation.section.embedded.end.ruby + + 1 + + name + source.ruby name - string.unquoted.heredoc.ruby + meta.embedded.line.ruby patterns include - #heredoc - - - include - #interpolated_ruby + #nest_curly_and_self include - source.lua + $self + + repository + + nest_curly_and_self - include - #escaped_char + patterns + + + begin + \{ + captures + + 0 + + name + punctuation.section.scope.ruby + + + end + \} + patterns + + + include + #nest_curly_and_self + + + + + include + $self + + - + - - - - begin - (?=(?><<-("?)((?:[_\w]+_|)RUBY)\b\1)) - comment - Heredoc with embedded ruby - end - (?!\G) - name - meta.embedded.block.ruby - patterns - - begin - (?><<-("?)((?:[_\w]+_|)RUBY)\b\1) - beginCaptures + captures - 0 + 1 name - punctuation.definition.string.begin.ruby + punctuation.definition.variable.ruby - contentName - source.ruby - end - \s*\2$\n? - endCaptures + match + (#@)[a-zA-Z_]\w* + name + variable.other.readwrite.instance.ruby + + + captures - 0 + 1 name - punctuation.definition.string.end.ruby + punctuation.definition.variable.ruby + match + (#@@)[a-zA-Z_]\w* name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - source.ruby - + variable.other.readwrite.class.ruby + + + captures + + 1 - include - #escaped_char + name + punctuation.definition.variable.ruby - + + match + (#\$)[a-zA-Z_]\w* + name + variable.other.readwrite.global.ruby + percent_literals - begin - (?=(?><<-("?)((?:[_\w]+_|)GRAPHQL)\b\1)) - comment - Heredoc with embedded GraphQL - end - (?!\G) - name - meta.embedded.block.graphql patterns begin - (?><<-("?)((?:[_\w]+_|)GRAPHQL)\b\1) + %i(?:([(\[{<])|([^\w\s]|_)) beginCaptures 0 name - punctuation.definition.string.begin.ruby + punctuation.section.array.begin.ruby - contentName - source.graphql end - \s*\2$\n? + [)\]}>]\2|\1\2 endCaptures 0 name - punctuation.definition.string.end.ruby + punctuation.section.array.end.ruby name - string.unquoted.heredoc.ruby + meta.array.symbol.ruby patterns - include - #heredoc + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + include + #symbol + + - include - #interpolated_ruby + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + include + #symbol + + - include - source.graphql + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + include + #symbol + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + include + #symbol + + include - #escaped_char + #symbol + repository + + angles + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\<|\\> + name + constant.other.symbol.ruby + + + begin + < + captures + + 0 + + name + constant.other.symbol.ruby + + + end + > + patterns + + + include + #angles + + + include + #symbol + + + + + + braces + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\{|\\\} + name + constant.other.symbol.ruby + + + begin + \{ + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \} + patterns + + + include + #braces + + + include + #symbol + + + + + + brackets + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\[|\\\] + name + constant.other.symbol.ruby + + + begin + \[ + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \] + patterns + + + include + #brackets + + + include + #symbol + + + + + + parens + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\(|\\\) + name + constant.other.symbol.ruby + + + begin + \( + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \) + patterns + + + include + #parens + + + include + #symbol + + + + + + symbol + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\\|\\[ ] + name + constant.other.symbol.ruby + + + match + \S\w* + name + constant.other.symbol.ruby + + + + - - - - begin - (?>[=,]\s*<<(\w+)) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - end - ^\1$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?><<-(\w+)) - beginCaptures - - 0 - - name - punctuation.definition.string.begin.ruby - - - comment - heredoc with indented terminator - end - \s*\1$ - endCaptures - - 0 - - name - punctuation.definition.string.end.ruby - - - name - string.unquoted.heredoc.ruby - patterns - - - include - #heredoc - - - include - #interpolated_ruby - - - include - #escaped_char - - - - - begin - (?<=\{|do|\{\s|do\s)(\|) - captures - - 1 - - name - punctuation.separator.variable.ruby - - - end - (\|) - patterns - - match - [_a-zA-Z][_a-zA-Z0-9]* + begin + %I(?:([(\[{<])|([^\w\s]|_)) + beginCaptures + + 0 + + name + punctuation.section.array.begin.ruby + + + end + [)\]}>]\2|\1\2 + endCaptures + + 0 + + name + punctuation.section.array.end.ruby + + name - variable.other.block.ruby + meta.array.symbol.interpolated.ruby + patterns + + + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + include + #symbol + + + + + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + include + #symbol + + + + + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + include + #symbol + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + include + #symbol + + + + + include + #symbol + + + repository + + angles + + patterns + + + begin + < + captures + + 0 + + name + constant.other.symbol.ruby + + + end + > + patterns + + + include + #angles + + + include + #symbol + + + + + + braces + + patterns + + + begin + \{ + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \} + patterns + + + include + #braces + + + include + #symbol + + + + + + brackets + + patterns + + + begin + \[ + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \] + patterns + + + include + #brackets + + + include + #symbol + + + + + + parens + + patterns + + + begin + \( + captures + + 0 + + name + constant.other.symbol.ruby + + + end + \) + patterns + + + include + #parens + + + include + #symbol + + + + + + symbol + + patterns + + + begin + (?=\\|#\{) + end + (?!\G) + name + constant.other.symbol.ruby + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + + + match + \S\w* + name + constant.other.symbol.ruby + + + + - match - , + begin + %q(?:([(\[{<])|([^\w\s]|_)) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + end + [)\]}>]\2|\1\2 + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - punctuation.separator.variable.ruby - - - - - match - => - name - punctuation.separator.key-value - - - match - <<=|%=|&=|\*=|\*\*=|/=|\+=|\-=|\^=|\|{1,2}=|<< - name - keyword.operator.assignment.augmented.ruby - - - match - <=>|<(?!<|=)|>(?!<|=|>)|<=|>=|===|==|=~|!=|!~|(?<=[ \t])\? - name - keyword.operator.comparison.ruby - - - match - (?<=[ \t])!+|\bnot\b|&&|\band\b|\|\||\bor\b|\^ - name - keyword.operator.logical.ruby - - - match - (%|&|\*\*|\*|\+|\-|/) - name - keyword.operator.arithmetic.ruby - - - match - = - name - keyword.operator.assignment.ruby - - - match - \||~|>> - name - keyword.operator.other.ruby - - - match - : - name - punctuation.separator.other.ruby - - - match - \; - name - punctuation.separator.statement.ruby - - - match - , - name - punctuation.separator.object.ruby - - - match - \.|:: - name - punctuation.separator.method.ruby - - - match - \{ - name - punctuation.section.scope.begin.ruby - - - match - \} - name - punctuation.section.scope.end.ruby - - - match - \[ - name - punctuation.section.array.begin.ruby - - - match - \] - name - punctuation.section.array.end.ruby - - - match - \(|\) - name - punctuation.section.function.ruby - - - repository - - escaped_char - - match - \\(?:[0-7]{1,3}|x[\da-fA-F]{1,2}|.) - name - constant.character.escape.ruby - - heredoc - - begin - ^<<-?\w+ - end - $ - patterns - - - include - $self + string.quoted.other.ruby + patterns + + + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + + + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + + + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + + + repository + + angles + + patterns + + + match + \\<|\\>|\\\\ + name + constant.character.escape.ruby + + + begin + < + end + > + patterns + + + include + #angles + + + + + + braces + + patterns + + + match + \\\{|\\\}|\\\\ + name + constant.character.escape.ruby + + + begin + \{ + end + \} + patterns + + + include + #braces + + + + + + brackets + + patterns + + + match + \\\[|\\\]|\\\\ + name + constant.character.escape.ruby + + + begin + \[ + end + \] + patterns + + + include + #brackets + + + + + + parens + + patterns + + + match + \\\(|\\\)|\\\\ + name + constant.character.escape.ruby + + + begin + \( + end + \) + patterns + + + include + #parens + + + + + + - - - interpolated_ruby - - patterns - begin - #\{ + %Q?(?:([(\[{<])|([^\w\s=]|_)) beginCaptures 0 name - punctuation.section.embedded.begin.ruby + punctuation.definition.string.begin.ruby - contentName - source.ruby end - (\}) + [)\]}>]\2|\1\2 endCaptures 0 name - punctuation.section.embedded.end.ruby - - 1 - - name - source.ruby + punctuation.definition.string.end.ruby name - meta.embedded.line.ruby + string.quoted.other.interpolated.ruby patterns + + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + + + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + + + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + include - #nest_curly_and_self + #escaped_char include - $self + #interpolated_ruby - - - captures + repository - 1 + angles - name - punctuation.definition.variable.ruby + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + < + end + > + patterns + + + include + #angles + + + + + + braces + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \{ + end + \} + patterns + + + include + #braces + + + + + + brackets + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \[ + end + \] + patterns + + + include + #brackets + + + + + + parens + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \( + end + \) + patterns + + + include + #parens + + + + - match - (#@)[a-zA-Z_]\w* - name - variable.other.readwrite.instance.ruby - captures + begin + %r(?:([(\[{<])|([^\w\s]|_)) + beginCaptures - 1 + 0 name - punctuation.definition.variable.ruby + punctuation.definition.string.begin.ruby - match - (#@@)[a-zA-Z_]\w* - name - variable.other.readwrite.class.ruby - - - captures + end + ([)\]}>]\2|\1\2)[eimnosux]* + endCaptures - 1 + 0 name - punctuation.definition.variable.ruby + punctuation.definition.string.end.ruby - match - (#\$)[a-zA-Z_]\w* - name - variable.other.readwrite.global.ruby - - - - nest_brackets - - begin - \[ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \] - patterns - - - include - #nest_brackets - - - - nest_brackets_i - - begin - \[ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \] - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_brackets_i - - - - nest_brackets_r - - begin - \[ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \] - patterns - - - include - #regex_sub - - - include - #nest_brackets_r - - - - nest_curly - - begin - \{ - captures - - 0 - name - punctuation.section.scope.ruby - - - end - \} - patterns - - - include - #nest_curly + string.regexp.percent.ruby + patterns + + + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + + + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + + + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + + + include + #regex_sub + + + repository + + angles + + patterns + + + include + #regex_sub + + + begin + < + end + > + patterns + + + include + #angles + + + + + + braces + + patterns + + + include + #regex_sub + + + begin + \{ + end + \} + patterns + + + include + #braces + + + + + + brackets + + patterns + + + include + #regex_sub + + + begin + \[ + end + \] + patterns + + + include + #brackets + + + + + + parens + + patterns + + + include + #regex_sub + + + begin + \( + end + \) + patterns + + + include + #parens + + + + + + - - - nest_curly_and_self - - patterns - begin - \{ - captures + %s(?:([(\[{<])|([^\w\s]|_)) + beginCaptures 0 name - punctuation.section.scope.ruby + punctuation.definition.constant.begin.ruby end - \} + [)\]}>]\2|\1\2 + endCaptures + + 0 + + name + punctuation.definition.constant.end.ruby + + + name + constant.other.symbol.percent.ruby patterns - include - #nest_curly_and_self + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + + + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + + + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + repository + + angles + + patterns + + + match + \\<|\\>|\\\\ + name + constant.character.escape.ruby + + + begin + < + end + > + patterns + + + include + #angles + + + + + + braces + + patterns + + + match + \\\{|\\\}|\\\\ + name + constant.character.escape.ruby + + + begin + \{ + end + \} + patterns + + + include + #braces + + + + + + brackets + + patterns + + + match + \\\[|\\\]|\\\\ + name + constant.character.escape.ruby + + + begin + \[ + end + \] + patterns + + + include + #brackets + + + + + + parens + + patterns + + + match + \\\(|\\\)|\\\\ + name + constant.character.escape.ruby + + + begin + \( + end + \) + patterns + + + include + #parens + + + + + + - include - $self - - - - nest_curly_i - - begin - \{ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \} - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_curly_i - - - - nest_curly_r - - begin - \{ - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \} - patterns - - - include - #regex_sub - - - include - #nest_curly_r - - - - nest_ltgt - - begin - \< - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \> - patterns - - - include - #nest_ltgt - - - - nest_ltgt_i - - begin - \< - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \> - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_ltgt_i - - - - nest_ltgt_r - - begin - \< - captures - - 0 - - name - punctuation.section.scope.ruby - - - end - \> - patterns - - - include - #regex_sub - - - include - #nest_ltgt_r - - - - nest_parens - - begin - \( - captures - - 0 - + begin + %w(?:([(\[{<])|([^\w\s]|_)) + beginCaptures + + 0 + + name + punctuation.section.array.begin.ruby + + + end + [)\]}>]\2|\1\2 + endCaptures + + 0 + + name + punctuation.section.array.end.ruby + + name - punctuation.section.scope.ruby - - - end - \) - patterns - - - include - #nest_parens + meta.array.string.ruby + patterns + + + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + include + #string + + + + + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + include + #string + + + + + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + include + #string + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + include + #string + + + + + include + #string + + + repository + + angles + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\<|\\> + name + string.other.ruby + + + begin + < + captures + + 0 + + name + string.other.ruby + + + end + > + patterns + + + include + #angles + + + include + #string + + + + + + braces + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\{|\\\} + name + string.other.ruby + + + begin + \{ + captures + + 0 + + name + string.other.ruby + + + end + \} + patterns + + + include + #braces + + + include + #string + + + + + + brackets + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\[|\\\] + name + string.other.ruby + + + begin + \[ + captures + + 0 + + name + string.other.ruby + + + end + \] + patterns + + + include + #brackets + + + include + #string + + + + + + parens + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\(|\\\) + name + string.other.ruby + + + begin + \( + captures + + 0 + + name + string.other.ruby + + + end + \) + patterns + + + include + #parens + + + include + #string + + + + + + string + + patterns + + + captures + + 0 + + name + constant.character.escape.ruby + + + match + \\\\|\\[ ] + name + string.other.ruby + + + match + \S\w* + name + string.other.ruby + + + + - - - nest_parens_i - - begin - \( - captures - - 0 + begin + %W(?:([(\[{<])|([^\w\s]|_)) + beginCaptures + + 0 + + name + punctuation.section.array.begin.ruby + + + end + [)\]}>]\2|\1\2 + endCaptures + + 0 + + name + punctuation.section.array.end.ruby + + name - punctuation.section.scope.ruby - - - end - \) - patterns - - - include - #interpolated_ruby - - - include - #escaped_char - - - include - #nest_parens_i + meta.array.string.interpolated.ruby + patterns + + + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + include + #string + + + + + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + include + #string + + + + + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + include + #string + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + include + #string + + + + + include + #string + + + repository + + angles + + patterns + + + begin + < + captures + + 0 + + name + string.other.ruby + + + end + > + patterns + + + include + #angles + + + include + #string + + + + + + braces + + patterns + + + begin + \{ + captures + + 0 + + name + string.other.ruby + + + end + \} + patterns + + + include + #braces + + + include + #string + + + + + + brackets + + patterns + + + begin + \[ + captures + + 0 + + name + string.other.ruby + + + end + \] + patterns + + + include + #brackets + + + include + #string + + + + + + parens + + patterns + + + begin + \( + captures + + 0 + + name + string.other.ruby + + + end + \) + patterns + + + include + #parens + + + include + #string + + + + + + string + + patterns + + + begin + (?=\\|#\{) + end + (?!\G) + name + string.other.ruby + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + + + match + \S\w* + name + string.other.ruby + + + + - - - nest_parens_r - - begin - \( - captures - - 0 + begin + %x(?:([(\[{<])|([^\w\s]|_)) + beginCaptures + + 0 + + name + punctuation.definition.string.begin.ruby + + + end + [)\]}>]\2|\1\2 + endCaptures + + 0 + + name + punctuation.definition.string.end.ruby + + name - punctuation.section.scope.ruby - - - end - \) - patterns - - - include - #regex_sub - - - include - #nest_parens_r + string.interpolated.percent.ruby + patterns + + + begin + \G(?<=\()(?!\)) + end + (?=\)) + patterns + + + include + #parens + + + + + begin + \G(?<=\[)(?!\]) + end + (?=\]) + patterns + + + include + #brackets + + + + + begin + \G(?<=\{)(?!\}) + end + (?=\}) + patterns + + + include + #braces + + + + + begin + \G(?<=<)(?!>) + end + (?=>) + patterns + + + include + #angles + + + + + include + #escaped_char + + + include + #interpolated_ruby + + + repository + + angles + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + < + end + > + patterns + + + include + #angles + + + + + + braces + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \{ + end + \} + patterns + + + include + #braces + + + + + + brackets + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \[ + end + \] + patterns + + + include + #brackets + + + + + + parens + + patterns + + + include + #escaped_char + + + include + #interpolated_ruby + + + begin + \( + end + \) + patterns + + + include + #parens + + + + + + @@ -3060,34 +4210,42 @@ 1 name - punctuation.definition.arbitrary-repitition.ruby + punctuation.definition.quantifier.begin.ruby 3 name - punctuation.definition.arbitrary-repitition.ruby + punctuation.definition.quantifier.end.ruby match (\{)\d+(,\d+)?(\}) name - string.regexp.arbitrary-repitition.ruby + keyword.operator.quantifier.ruby begin - \[(?:\^?\])? - captures + \[\^? + beginCaptures 0 name - punctuation.definition.character-class.ruby + punctuation.definition.character-class.begin.ruby end \] + endCaptures + + 0 + + name + punctuation.definition.character-class.end.ruby + + name - string.regexp.character-class.ruby + constant.other.character-class.set.ruby patterns @@ -3141,7 +4299,7 @@ end \) name - string.regexp.group.ruby + meta.group.regexp.ruby patterns @@ -3165,14 +4323,6 @@ We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags. end $\n? - endCaptures - - 0 - - name - punctuation.definition.comment.ruby - - name comment.line.number-sign.ruby diff --git a/Tests/percent_literals.rb b/Tests/percent_literals.rb new file mode 100644 index 0000000..9164d59 --- /dev/null +++ b/Tests/percent_literals.rb @@ -0,0 +1,130 @@ +# Default – Interpolated +%(The quick #{color} fox jumps over the #{temperment} dog) +%[The quick #{color} fox jumps over the #{temperment} dog] +%{The quick #{color} fox jumps over the #{temperment} dog} +% +%:The quick #{color} fox jumps over the #{temperment} dog: + +%(The quick #{color} fox (jumps over the #{temperment} dog)) +%[The quick #{color} fox [jumps over the #{temperment} dog]] +%{The quick #{color} fox {jumps over the #{temperment} dog}} +%> + + +# Non-interpolated +%q(The quick brown fox jumps over the lazy dog) +%q[The quick brown fox jumps over the lazy dog] +%q{The quick brown fox jumps over the lazy dog} +%q +%q:The quick brown fox jumps over the lazy dog: + +%q(The quick brown fox (jumps over the lazy dog)) +%q[The quick brown fox [jumps over the lazy dog]] +%q{The quick brown fox {jumps over the lazy dog}} +%q> + + +# Interpolated +%Q(The quick #{color} fox\njumps over the #{temperment} dog) +%Q[The quick #{color} fox\njumps over the #{temperment} dog] +%Q{The quick #{color} fox\njumps over the #{temperment} dog} +%Q +%Q:The quick #{color} fox\njumps over the #{temperment} dog: + +%Q(The quick #{color} fox\n(jumps over the #{temperment} dog)) +%Q[The quick #{color} fox\n[jumps over the #{temperment} dog]] +%Q{The quick #{color} fox\n{jumps over the #{temperment} dog}} +%Q> + +%Q:The quick #{color} fox\n}jumps over the #{temperment} dog: # Don't let a stray closing + # character end string + +# Regular expression +%r(The quick brown fox jumps over the lazy dog)i +%r[The quick brown fox jumps over the lazy dog]i +%r{The quick brown fox jumps over the lazy dog}i +%ri +%r:The quick brown fox jumps over the lazy dog:i + +%r(The quick #{color} fox (jumps over the lazy dog))i +%r[The quick #{color} fox [jumps over the lazy dog]]i +%r{The quick #{color} fox {jumps over the lazy dog}}i +%r>i + + +# Symbol Array – Non-interpolated +%i(afgan akita azawakh) +%i[afgan akita azawakh] +%i{afgan akita azawakh} +%i +%i:afgan akita azawakh: + +%i(afgan akita (azawakh)) # Symbol should include the punctuation +%i[afgan akita [ azawakh]] # [ Should be it's own separate symbol +%i{afgan akita {azawakh}} +%i> # \< Should be included in symbol and escaped + + +# Symbol Array – Interpolated +%I(afgan akita #{breed}) +%I[afgan akita #{breed}] +%I{afgan akita #{breed}} +%I +%I:afgan akita #{breed}: + +%I(afgan akita (#{breed})) +%I[afgan akita [#{breed}]] +%I{afgan akita {#{breed}}} +%I> + + +# Array – Non-interpolated +%w(cheetah leopard mountain\ lion) # mountain lion should be a single string +%w[cheetah leopard mountain\ lion] +%w{cheetah leopard mountain\ lion} +%w +%w:cheetah leopard mountain\ lion: + +%w(cheetah leopard (mountain\ lion)) +%w[cheetah leopard [mountain\ lion]] +%w{cheetah leopard {mountain\ lion}} +%w> + + +# Array – Interpolated +%W(cheetah leopard #{codename}) +%W[cheetah leopard #{codename}] +%W{cheetah leopard #{codename}} +%W +%W:cheetah leopard #{codename}: + +%W(cheetah leopard (#{codename})) +%W[cheetah leopard [#{codename}]] +%W{cheetah leopard {#{codename}}} +%W> + + +# Shell Command – Interpolated +%x(mate Bundles/#{name}.tmbundle) +%x[mate Bundles/#{name}.tmbundle] +%x{mate Bundles/#{name}.tmbundle} +%x +%x:mate Bundles/#{name}.tmbundle: + +%x(mate Bundles/(ruby).tmbundle) +%x[mate Bundles/[ruby].tmbundle] +%x{mate Bundles/{ruby}.tmbundle} +%x.tmbundle> + + +# Symbol – Non-interpolated +%s(avian) +%s[avian] +%s{avian} +%s +%s:avian: + +%s(text(mate)) +%s[text[mate]] +%s{text{mate}} +%s> diff --git a/info.plist b/info.plist index c1e7ff3..3539dea 100644 --- a/info.plist +++ b/info.plist @@ -6,22 +6,6 @@ wnzrf@tenlcebqhpgvbaf.arg contactName James Edward Gray II - deleted - - 3988A501-119E-4C0E-A584-C5E75FC2D6C6 - 8C102BE9-6E49-11D9-A933-000D93589AF6 - EE5F1AE5-6C02-11D9-92BA-0011242E4184 - 8394EDEF-87E8-11D9-A6A3-000D93589AF6 - BE3B3E5E-733E-11D9-A833-000A95A89C98 - 66708792-62C3-11D9-B8CF-000D93589AF6 - 667089D2-62C3-11D9-B8CF-000D93589AF6 - 667080D9-62C3-11D9-B8CF-000D93589AF6 - 667081DE-62C3-11D9-B8CF-000D93589AF6 - 66708259-62C3-11D9-B8CF-000D93589AF6 - 66708052-62C3-11D9-B8CF-000D93589AF6 - 6670881E-62C3-11D9-B8CF-000D93589AF6 - 7990EE60-C850-4779-A8C0-7FD2C853B99B - description Support for the <a href="http://www.ruby-lang.org/">Ruby</a> programming language. mainMenu @@ -39,13 +23,16 @@ items 35222962-C50D-4D58-A6AE-71E7AD980BE4 + 4444CB9A-8345-4116-8349-C359ADDA390C 5289EE40-86B8-11D9-A8D4-000A95E13C98 ------------------------------------ D5660BB2-C554-4694-9E0F-F20CDB6B9EA0 6EA7AE06-3EA9-497D-A6DE-732DE43DA6E9 + 535AF150-5613-44DB-AB41-EBB934A5865F ------------------------------------ 8646378E-91F5-4771-AC7C-43FC49A93576 EE5F19BA-6C02-11D9-92BA-0011242E4184 + 64BB4EE2-2803-410C-B140-EA545A13F250 ------------------------------------ EE5F1FB2-6C02-11D9-92BA-0011242E4184 FBFC214F-B019-4967-95D2-028F374A3221 @@ -87,6 +74,9 @@ 0BA2B2F1-E767-4A03-9791-0AC0183251F1 B46D35B8-5DEB-4C10-A110-BA1965A2EB9C 97054C4D-E4A3-45B1-9C00-B82DBCB30CAD + 20ACDEEE-1F1D-4CFB-8B66-940E902693EF + ------------------------------------ + 2BB6D28F-914E-4132-BC53-E43CF5060BFA name Idioms @@ -325,6 +315,8 @@ 988C8AEF-FC71-4455-9C4F-9338C05685A4 ------------------------------------ 7BC1E159-0C90-4B0D-8808-80165C11F59C + ------------------------------------ + 5CB8BCD2-20A5-45E5-A40B-7708C7B8763A name Methods @@ -432,204 +424,6 @@ name Ruby - ordering - - 35222962-C50D-4D58-A6AE-71E7AD980BE4 - 5289EE40-86B8-11D9-A8D4-000A95E13C98 - D5660BB2-C554-4694-9E0F-F20CDB6B9EA0 - 1AD6A138-2E89-4D6A-AB3F-416BF9CE968D - 931DD73E-615E-476E-9B0D-8341023AE730 - DAA69A0C-FC1E-4509-9931-DFFB38B4D6AE - 2DDB6FE0-6111-4C40-A149-8E67E76F8272 - BF4CA9F1-51CD-48D4-8357-852234F59046 - 8646378E-91F5-4771-AC7C-43FC49A93576 - EE5F19BA-6C02-11D9-92BA-0011242E4184 - 76FCF165-54CB-4213-BC55-BD60B9C6A3EC - EE5F1FB2-6C02-11D9-92BA-0011242E4184 - FBFC214F-B019-4967-95D2-028F374A3221 - 9FB64639-F776-499B-BA6F-BB45F86F80FD - 7F79BC8D-8A4F-4570-973B-05DFEC25747F - B297E4B8-A8FF-49CE-B9C4-6D4911724D43 - 835FAAC6-5431-436C-998B-241F7226B99B - 0275EF39-9357-408F-AF20-79E415CA9504 - 59E811FF-E722-46BE-8938-04713612FABB - F4EEB2B6-07D8-402F-8FC3-79B7308D2576 - 97054C4D-E4A3-45B1-9C00-B82DBCB30CAD - 569C9822-8C41-4907-94C7-1A8A0031B66D - 6519CB08-8326-4B77-A251-54722FFBFC1F - 47D203ED-EB9B-4653-A07B-A897800CEB76 - C122CD92-DDBE-4869-9C7A-CC2B254C9411 - 121B334B-2AA6-4E9A-A8B8-BF93B627982B - 58FDEA60-10AF-4C49-AA09-29B77030DB25 - 33969819-62C5-4E03-B824-C2337205F364 - 7E084412-80E6-4B70-8092-C03D1ECE4CD2 - EC73D5CC-5F05-46B9-A6F4-82037E4A38C9 - 825B721D-4367-4DF7-98C0-F005695DF9E3 - BFB65D1C-62F1-485D-8A67-3E5A2E55107C - C649F945-DAB8-4DA2-B73C-2EFF9D7D34F3 - 5AE7CFB4-418E-4E00-AD76-06DB755EE876 - 9460392B-C036-4A76-A5AE-1191F10E4B1B - 2C07D4E7-D74F-4AE4-82BE-B0BA82247AFA - F6BF907E-FDF7-4D9B-9E57-BE159561349D - E5158F94-CC52-4424-A495-14EF9272653F - A83F68A9-F751-4BB4-AE16-56812878C16A - 05984208-D559-4C04-A69C-2019361A985A - ED6368FB-A11D-4622-9F42-7879481094F1 - 88BC3896-DC39-4307-A271-21D33340F15A - FDFABCB9-DF58-4469-AE11-5407A4FF4D70 - 0F940CBC-2173-49FF-B6FD-98A62863F8F2 - 667083EE-62C3-11D9-B8CF-000D93589AF6 - 48D8E498-C9A5-4B1B-9A18-71A5860276FB - 4E9A7A73-875C-11D9-897C-000393CBCE2E - 7BC1E159-0C90-4B0D-8808-80165C11F59C - 6670835F-62C3-11D9-B8CF-000D93589AF6 - 667082E6-62C3-11D9-B8CF-000D93589AF6 - CD1609FA-47DA-4EE4-9C5B-5C56D953F5B1 - F53E098D-D08E-4CE2-990A-B0BD70E60614 - D121FC61-96A4-4B8F-8709-280EDA876FF3 - 488B387C-50C0-4B2D-9260-5A7E7EAF9B42 - BF487539-8085-4FF4-8601-1AD20FABAEDC - 83EED068-8C1C-4BAF-9893-902DC00616AB - 0CCBE04E-F4E2-4E55-9506-7DE67ACF8388 - 05DFF82C-5A29-4EBD-93FE-C165FFFB5EA8 - E98FB8F9-7302-431D-8BF2-275A68A6126C - AFE1D078-EA16-45F5-AD8A-FAC1B523D861 - C7AAAE45-487A-4B61-8962-D47675AAC05F - 2B73EC5F-06D2-460C-A14F-6FA05AFCF0CC - 0E85EC81-2FAB-4648-B590-119CC1BB6E41 - A71A18CF-2D71-4BFF-AA0C-D9B8C59BC4EB - A150C2D8-25B3-4339-BC92-8A0160A70486 - 3D383096-A03F-4EF8-9060-3C727045AB34 - D7A7D3C9-1714-4C50-8CC0-D83A03883E8F - AAD5D511-6BE7-41DA-8F2B-1593A48FBB08 - 6C9D6B3D-D8E9-4606-9534-577C8D21FFF6 - 7F46C90A-595B-4B83-A4F7-058F63CE4218 - 7C6E88FA-CA0E-4110-8C75-A94E54286A75 - 87D5F8AD-8DA6-4AED-A0D8-B51CAC980445 - 4E9D15B5-65D6-4A9A-9DEC-DE041D68C06F - C44ED391-614F-4BA2-BB0F-87668EEA9954 - 4A6EFD6B-88E2-4822-AD48-03460EDBC796 - 988C8AEF-FC71-4455-9C4F-9338C05685A4 - 451A0596-1F72-4AFB-AF2F-45900FABB0F7 - A05CBDD6-845D-45EB-94FB-F8787F5456BE - B2C3ADE8-E19E-4B87-9C6C-593D490114C7 - 97DE939B-D243-4D5C-B953-1C9090912E7C - 34FEBB9F-73CD-4DD4-A0A3-1CF2A5E3DE78 - E16D24D2-CC7E-4786-BE0B-1725FC865D78 - 21C0D711-F32A-4665-AA0D-B136F9DD3945 - 49D69DEC-6991-49F4-8D9B-BA60BFDD3D17 - DAE6A754-D906-4763-B816-CE67125CEF08 - 263C94DC-63CF-4BA3-9692-C5582CA8F1AB - 6021BBDC-4AAD-447B-A0C2-A4BB31721558 - 3DDB99C4-486D-4C11-A217-5680FDD8EC19 - FD010022-E0E7-44DB-827F-33F7D9310DA2 - 4991BB86-736E-4758-B9B2-E4FA90B9368F - 36853A11-0307-4AE7-B835-7CE6358717A5 - 206D54AF-E67A-4DF0-B7F4-3D42FEB81685 - 51954118-81D7-42B6-9A10-BE23D8B9FFE2 - 567E3D18-BF2B-4379-8927-2777EC9F495E - ECBA4CA0-275F-460E-85BE-E82FEA2E2B26 - 338EC03D-3FF4-4435-94E8-1CEF20CEC75D - FDD73070-6D32-4301-A86A-C55B77C3D8ED - 3C04589C-5127-478E-97B3-CA7DD2EA7ECD - 689120C9-AB40-4081-8268-9362E00FA4A0 - E54F7077-3C33-4B53-A4F7-21E16132D3AD - 02913388-EE8E-4C55-AC94-94F3D751F47E - 7A3CECED-452B-438E-A5C6-95B6BDC43243 - CD748479-D2A4-4AB5-95BD-4C89512BA210 - 844DBD70-BC23-4FBF-9C18-F4A610239DF2 - 1DD13CF5-39C0-4F10-B655-56DACEBC7F94 - F3C5F719-EF03-4FF7-A777-4A8402FE3B6B - B563E0D7-513D-49B4-9733-1B04A6F25A74 - 5A3754FC-43A3-462B-AB42-E3E951872E6F - BD4CFD7B-1AC0-4569-9BDA-FD491F41F4E6 - 9E0B4D4B-2956-4B3A-800A-3D8CE54E66BF - BA9440C9-36C3-4031-BB61-67B581D5B179 - B0CE57EC-FB2E-4482-8CCE-448DC2588715 - 07D1F987-7CDB-4EAD-B64A-27A93051700E - A3B9B76B-2BC5-425C-AB24-9FAAFC375798 - 5DA9E1E8-2C54-420A-9B84-B040A1AF2B9E - 669A86AD-936F-4EDA-8E4E-6863804072DA - 6C6B9849-9631-49FF-A9F9-F0E94A1512C5 - 1F72122A-35AD-4BA1-AA01-889A10319666 - E23FE534-8061-4828-98A5-46270B6910B0 - 197709C5-8382-4A59-B6D7-31A0CC0F23B7 - 9D9E7BA3-8C5D-4532-83EA-326358C2F5BB - 98182B9E-7C61-4824-BE4C-9CD69C816037 - CB03D11A-7204-48D0-92C1-E109034403E7 - 52B8BF63-F09E-4789-8407-06168A8AE666 - B79B9DAB-ABEF-44F6-BF7E-635E7BA11DFD - 4E409AA4-E7D4-46B7-A4E9-E32F992B33E9 - 8021944C-CEA4-4983-8D1C-78D18D4004A1 - 2514FC26-468C-4D08-A788-494A444C4286 - 66802933-B49F-479B-9DF9-1D898FF1FA90 - 855FC4EF-7B1E-48EE-AD4E-5ECB8ED79D1C - 4B72C5C3-6CA7-41AC-B2F9-51DEA25D469E - 21E75321-0CF7-45E8-A297-BCC7C0DDDD15 - E16EE658-1CA0-4950-954B-B962E50B754F - 840B9C4C-7037-4C3B-9028-EB9DC75EDB3E - B9E3A6DF-875D-11D9-897C-000393CBCE2E - 418F1817-255F-430A-B09A-222964ED66A7 - 8F594E5E-6F46-4E98-B5FB-1C8F3BA9828F - 50C56AC8-48F3-42A0-AF10-8164464AFAEF - 397FA09F-A30F-4EE4-920C-318D5004EE97 - 332AA973-AA71-48CB-AEE9-1D71E11019AC - 8EBBB26F-980E-404E-8366-74E5772298F6 - 678BDB83-FBBD-4E8E-BE0B-E1A98AECB247 - A4E89D97-D5ED-48BB-B5FF-1BFB79211FCD - 8CEF9711-88D5-4202-AFB9-29EF4EFD25C1 - C3C48948-4F49-484E-A8DE-DEB44723099E - 209D5D73-7A77-4931-A158-3FB6D5B48A88 - 31D1F145-33AB-4441-BA11-4D1C46928C4C - 00F66D41-25AF-4597-B67D-E540965A5222 - 5297FD0C-98B1-4514-BBD1-1516810BECA6 - B32C147D-44A6-478A-9D5D-189D7831E9A7 - 43A61A22-6BEE-4997-961C-1CDE739C05FE - A243E96F-DC21-4AA0-B340-13A7674F6AFF - 429D0EF5-580D-4166-8F79-713DE96B77F1 - 0E831E03-67E1-4357-8323-C60685C23C4F - 671F05E2-D9CC-485E-BB1B-B13EF20FAC65 - 4C79256C-480A-459C-BDE8-BB0D972811DB - 79FEC3CC-2A40-4611-9A85-ECDB22FE0701 - 711ED6C3-0F18-41FB-9A7D-3094BB319A85 - A072BB1E-1DD1-45D3-9346-8CA3BA21B364 - 1B925A4D-8EE4-442B-9254-293599F5717F - 68B21F6F-5D89-41FA-A19C-F29C2F912B4E - 82F8EEE0-2452-411E-8102-7BFDDBCA2E72 - 09A11FDA-49FC-4466-8787-8D1D5D111A89 - 29340695-E426-4F77-8CF7-C59360A549F4 - F91C25EC-EC76-498B-BFB5-FDA8F57C5875 - 7850AD5C-A90D-4E2C-A931-EADFF8D3D9A3 - 05655BD8-23C6-445F-BFD1-420BF25C3030 - 33639D7A-BD8C-4396-9C44-307B8AC87C9E - DB457094-1AC9-4856-AEFC-43A9576B6775 - B186BAC0-D981-41AC-B8F4-34BAD2BC4EE6 - F46A4687-E52D-40D2-9072-C215645EDBC6 - 942F20E2-C40A-44B8-A3F2-99AAC68CB534 - 1C60D589-DD46-4109-90CA-6B34AEA2F298 - 0CB48BCA-3F6E-4AE0-85BC-08A1D2508216 - 20AAD0BC-075D-4EC0-9057-E3E5E62C4125 - 5B46ECFD-23A4-4F0C-9951-F64C19C72C2B - 46BF99AD-E172-4D49-BCF7-072F4730E1D9 - 3BA6762A-BB6B-489E-8006-F30F386AEF48 - 8343ACF4-EEB7-44B5-B835-94826466D4D5 - B904D4AA-D15D-48A4-8EB2-563BAF489332 - CC300D44-6C3F-4F6C-A8AB-86F5A2DC57CF - 2DBEE50B-3097-4A57-AB48-3586CF392D8B - 0BA2B2F1-E767-4A03-9791-0AC0183251F1 - B46D35B8-5DEB-4C10-A110-BA1965A2EB9C - 05EE1046-5ED7-48F5-8693-1F066163B2F4 - A7BF14E6-59B1-42E5-8755-8A72BF13685E - EEE6D060-C5A0-400D-A2E0-0835013C5365 - E00B62AC-6B1C-11D9-9B1F-000D93589AF6 - 1D26F26C-C6F7-434F-84F8-FEE895372E8A - 6FEAF60F-F0F3-4618-9259-DE93285F50D1 - 92E190C9-A861-4025-92D4-D6B5A24C22D4 - A5D50494-EB97-48DE-A2BE-322DF52A7A7A - 6D75102B-6E51-4360-8F12-BE12327B6AE6 - AEDD6A5F-417F-4177-8589-B07518ACA9DE - 1A7701FA-D866-498C-AD4C-7846538DB535 - uuid 467B298F-6227-11D9-BFB1-000D93589AF6