2016-10-19 20:33:21 +03:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"language": "ruby",
|
2016-11-01 18:50:54 +03:00
|
|
|
"fileExt": ".rb",
|
|
|
|
"repoUrl": "https://github.com/diff-fixtures/ruby.git",
|
2016-10-19 20:33:21 +03:00
|
|
|
"syntaxes": [
|
|
|
|
{
|
|
|
|
"syntax": "assignment",
|
|
|
|
"insert": "x = 0",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "x = 1"
|
2016-10-20 20:07:15 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "comment",
|
|
|
|
"insert": "# This is a comment",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "=begin\nThis is a multiline\ncomment\n=end"
|
2016-10-21 22:58:50 +03:00
|
|
|
},
|
2016-10-21 23:55:00 +03:00
|
|
|
{
|
|
|
|
"syntax": "number",
|
|
|
|
"insert": "1234\n1_234\n0d1_234\n0xa_bcd_ef0_123_456_789\n0o1234567\n0b1_0\n1.234_5e678_90\n",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "1235\n1_235\n0d1_235\n0xa_bcd_ef0_123_456_788\n0o1234576\n0b1_1\n1.234_5e678_91\n"
|
2016-10-21 23:55:00 +03:00
|
|
|
},
|
2016-10-21 22:58:50 +03:00
|
|
|
{
|
|
|
|
"syntax": "symbol",
|
|
|
|
"insert": ":foo\n:'foo'\n:\"foo\"",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": ":bar\n:'bar'\n:\"bar\""
|
2016-10-21 22:58:50 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "string",
|
|
|
|
"insert": "''\n'foo with \"bar\"'",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "\"\"\n\"bar with 'foo'\""
|
2016-10-21 22:58:50 +03:00
|
|
|
},
|
|
|
|
{
|
2016-10-21 23:55:00 +03:00
|
|
|
"syntax": "interpolation",
|
|
|
|
"insert": ":\"foo #{bar}\"\n\"foo #{bar}\"",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": ":\"bar #{foo}\"\n\"bar #{foo}\""
|
2016-10-22 00:41:04 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "delimiter",
|
2016-10-27 18:24:43 +03:00
|
|
|
"insert": "%q#a#\n%q<a<b>c>\n%#a#\n%Q#a#\n%<a<b>c>\n%Q<a<b>c>",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "%q/b/\n%q{d{e}f}\n%/b/\n%Q/b/\n%{d{e}f}\n%Q{d{e}f}"
|
2016-10-22 01:52:40 +03:00
|
|
|
},
|
|
|
|
{
|
2016-10-31 23:21:58 +03:00
|
|
|
"syntax": "math-assignment",
|
2016-10-22 01:52:40 +03:00
|
|
|
"insert": "x += 1\nx -= 1\nx *= 1\nx /= 1\nx **= 1",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "x+= 2\nx -= 1\nx *= 1\nx /= 1\nx **= 1"
|
2016-10-24 20:43:31 +03:00
|
|
|
},
|
|
|
|
{
|
2016-10-31 23:21:58 +03:00
|
|
|
"syntax": "conditional-assignment",
|
2016-10-24 20:43:31 +03:00
|
|
|
"insert": "x ||= 5",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "x &&= 7"
|
2016-10-24 20:43:31 +03:00
|
|
|
},
|
|
|
|
{
|
2016-10-31 23:14:58 +03:00
|
|
|
"syntax": "multiple-assignments",
|
2016-10-24 20:43:31 +03:00
|
|
|
"insert": "x, y, z = 10, 20, 30",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "x, y = aVariable, 40"
|
2016-10-24 20:43:31 +03:00
|
|
|
},
|
|
|
|
{
|
2016-10-31 23:21:58 +03:00
|
|
|
"syntax": "pseudo-variables",
|
2016-10-24 20:43:31 +03:00
|
|
|
"insert": "nil\nself\nfalse\ntrue",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "self\nNIL\nTRUE\nFALSE"
|
2016-10-24 20:43:31 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "subshell",
|
|
|
|
"insert": "`ls -la`",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "`git status`"
|
2016-10-24 20:43:31 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "hash",
|
|
|
|
"insert": "{ :key1 => \"value\", :key2 => 1, \"key3\" => false, :\"symbol_key\" => 10 }",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "{ key1: \"changed value\", key2: 2, key3: true }"
|
2016-10-24 20:43:31 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "boolean-operator",
|
|
|
|
"insert": "a || b",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "a && b"
|
2016-10-24 20:43:31 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "relational-operator",
|
|
|
|
"insert": "x == y\nx != y\nx === y",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "x <=> y\nx =~ y\nx =! y"
|
2016-10-24 20:43:31 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "comparision-operator",
|
|
|
|
"insert": "x < y\na > b",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "x <= y\na >= b"
|
2016-10-24 20:43:31 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "bitwise-operator",
|
|
|
|
"insert": "a | b\na >> b\na ^ b",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "a & b\na << b"
|
2016-10-24 20:43:31 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "ternary",
|
2016-11-04 22:57:08 +03:00
|
|
|
"insert": "foo ? case1 : case2",
|
|
|
|
"replacement": "bar ? a : b"
|
2016-10-24 22:23:10 +03:00
|
|
|
},
|
2016-11-04 00:24:05 +03:00
|
|
|
{
|
|
|
|
"syntax": "method-declaration",
|
|
|
|
"insert": "def foo\nend",
|
|
|
|
"replacement": "def bar(a)\n baz\nend"
|
|
|
|
},
|
2016-11-04 00:27:47 +03:00
|
|
|
{
|
|
|
|
"syntax": "method-declaration-params",
|
|
|
|
"template": "def foo{0}\nend",
|
|
|
|
"insert": "(a)",
|
|
|
|
"replacement": "(a, b, c)"
|
|
|
|
},
|
2016-10-24 22:23:10 +03:00
|
|
|
{
|
|
|
|
"syntax": "method-invocation",
|
|
|
|
"insert": "print\nfoo.bar\nbar",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "print(\"hello world\")\nfoo.bar()\nbar 2, 3\nbar(2, 3)"
|
2016-10-25 21:36:30 +03:00
|
|
|
},
|
|
|
|
{
|
2016-11-05 00:49:39 +03:00
|
|
|
"syntax": "method-calls",
|
|
|
|
"insert": "x.foo()",
|
|
|
|
"replacement": "bar()"
|
|
|
|
},
|
|
|
|
{
|
2016-10-25 21:36:30 +03:00
|
|
|
"syntax": "class",
|
|
|
|
"insert": "class Foo < Super\n def test; end\nend",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "class Foo\n def test; end\nend"
|
2016-10-26 20:27:38 +03:00
|
|
|
},
|
2016-10-27 22:47:27 +03:00
|
|
|
{
|
|
|
|
"syntax": "module",
|
2016-11-04 22:57:08 +03:00
|
|
|
"insert": "module Foo\nend",
|
|
|
|
"replacement": "module Foo\n def bar\nend\nend"
|
2016-10-27 22:47:27 +03:00
|
|
|
},
|
2016-10-26 20:27:38 +03:00
|
|
|
{
|
|
|
|
"syntax": "return",
|
|
|
|
"insert": "return foo",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "return"
|
2016-10-26 20:27:38 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "yield",
|
|
|
|
"insert": "yield foo",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "yield"
|
2016-10-26 22:54:21 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "while",
|
|
|
|
"insert": "while foo do\nend\nfoo while run",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "while foo\n bar\nend"
|
2016-10-26 22:54:21 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "until",
|
|
|
|
"insert": "until foo do\nend\nfoo until done",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "until foo\n bar\nend"
|
2016-10-27 00:32:08 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "if",
|
|
|
|
"insert": "if foo\n bar\nelsif quux\n baz\nelse\n bat\nend",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "if x\nend\nif y then\nend"
|
2016-10-27 00:49:51 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "unless",
|
|
|
|
"insert": "unless foo\n bar\nelse\n bat\nend",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "unless x\nend\nunless y then\nend"
|
2016-10-27 00:49:51 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "if-unless-modifiers",
|
|
|
|
"insert": "print unless foo",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "print if foo"
|
2016-10-27 01:22:59 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "and-or",
|
|
|
|
"insert": "foo and bar",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "foo or bar\na or b and c"
|
2016-10-27 01:44:53 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "regex",
|
|
|
|
"insert": "/^(foo|bar[^_])$/i",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "%r/a/\n%r<a<b>c>"
|
2016-10-27 18:30:34 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "array",
|
|
|
|
"insert": "[ 1, 2, 3]",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "['a', 'b', 'c']"
|
2016-10-27 18:30:34 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "percent-array",
|
|
|
|
"insert": "%w(one two)",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "%W(one #{b} three)"
|
2016-10-27 19:24:28 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "lambda-dash-rocket",
|
|
|
|
"insert": "-> (a, b, c) {\n 1\n 2\n}",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "-> { foo }"
|
2016-10-27 19:24:28 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "lambda",
|
|
|
|
"insert": "lambda { foo }",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "lambda { |x| x + 1 }"
|
2016-10-27 20:07:24 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "for",
|
|
|
|
"insert": "for x in y\n f\nend",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "for i in [1,2,3] do\n print i\nend"
|
2016-10-31 20:15:44 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "element-reference",
|
|
|
|
"insert": "foo[bar]\nfoo[:bar]\nfoo[bar] = 1",
|
2016-11-02 20:52:40 +03:00
|
|
|
"replacement": "x[\"b\"]\nx[:\"c\"]"
|
2016-10-31 20:15:44 +03:00
|
|
|
},
|
2016-11-04 00:24:05 +03:00
|
|
|
{
|
|
|
|
"syntax": "begin",
|
|
|
|
"template": "def foo\n{0}end",
|
|
|
|
"insert": "begin\nend\n",
|
|
|
|
"replacement": "begin\n puts 'hi'\nend\n"
|
|
|
|
},
|
2016-11-02 21:16:57 +03:00
|
|
|
{
|
|
|
|
"syntax": "else",
|
2016-11-03 23:11:02 +03:00
|
|
|
"template": "begin\n foo()\n{0}end",
|
|
|
|
"insert": "else\n",
|
|
|
|
"replacement": "else\n bar()\n"
|
2016-11-02 22:32:46 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "elsif",
|
2016-11-03 23:11:02 +03:00
|
|
|
"template": "if bar\n foo()\n{0}end",
|
2016-11-03 23:01:39 +03:00
|
|
|
"insert": "elsif baz\n",
|
|
|
|
"replacement": "elsif baz\n qoz()\n"
|
2016-11-02 22:55:48 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "ensure",
|
2016-11-03 23:11:02 +03:00
|
|
|
"template": "begin\n foo\n{0}end",
|
2016-11-03 23:01:39 +03:00
|
|
|
"insert": "ensure\n",
|
|
|
|
"replacement": "ensure\n bar\n"
|
2016-11-02 23:05:30 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "rescue",
|
2016-11-03 23:26:53 +03:00
|
|
|
"template": "begin\n foo\n{0}end",
|
|
|
|
"insert": "rescue x\n",
|
|
|
|
"replacement": "rescue x\n bar\n"
|
2016-11-02 23:42:06 +03:00
|
|
|
},
|
2016-11-03 03:18:09 +03:00
|
|
|
{
|
|
|
|
"syntax": "rescue-empty",
|
|
|
|
"insert": "begin\n foo\nrescue\nend",
|
|
|
|
"replacement": "begin\n foo\nrescue\n bar\nend"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "rescue-last-ex",
|
|
|
|
"insert": "begin\n foo\nrescue Error => x\nend",
|
|
|
|
"replacement": "begin\n foo\nrescue Error => x\n bar\nend"
|
|
|
|
},
|
2016-11-03 19:23:35 +03:00
|
|
|
{
|
|
|
|
"syntax": "rescue-modifier",
|
|
|
|
"insert": "foo rescue nil",
|
|
|
|
"replacement": "foo rescue false"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "rescue-modifier2",
|
|
|
|
"insert": "foo rescue nil",
|
|
|
|
"replacement": "bar rescue nil"
|
|
|
|
},
|
2016-11-02 23:42:06 +03:00
|
|
|
{
|
|
|
|
"syntax": "when",
|
2016-11-03 23:11:02 +03:00
|
|
|
"template": "case foo\n{0}end",
|
|
|
|
"insert": "when bar\n",
|
|
|
|
"replacement": "when bar\n baz\n"
|
2016-11-02 23:46:33 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"syntax": "when-else",
|
2016-11-03 23:26:53 +03:00
|
|
|
"template": "case foo\nwhen bar\n baz\n{0}end",
|
|
|
|
"insert": "else\n",
|
|
|
|
"replacement": "else\n qoz\n"
|
2016-10-19 20:33:21 +03:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|