code-ruby-parser 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/code-ruby-parser.gemspec +3 -1
  3. data/lib/code-ruby-parser.rb +1 -7
  4. data/lib/template-ruby-parser.rb +1 -7
  5. data/template-ruby-parser.gemspec +3 -1
  6. metadata +18 -137
  7. data/.overcommit.yml +0 -4
  8. data/CHANGELOG.md +0 -35
  9. data/Gemfile +0 -5
  10. data/Gemfile.lock +0 -32
  11. data/bin/code-parser +0 -27
  12. data/bin/deploy +0 -16
  13. data/bin/format +0 -3
  14. data/bin/parse-docs +0 -6
  15. data/bin/template-parser +0 -27
  16. data/docs/class.code +0 -9
  17. data/docs/meetup.code +0 -14
  18. data/docs/precedence.code +0 -1
  19. data/docs/precedence.template +0 -35
  20. data/docs/rain.code +0 -23
  21. data/docs/slack.code +0 -17
  22. data/docs/stripe.code +0 -7
  23. data/docs/twitter.code +0 -7
  24. data/lib/code/parser/addition.rb +0 -13
  25. data/lib/code/parser/and_operator.rb +0 -13
  26. data/lib/code/parser/bitwise_and.rb +0 -13
  27. data/lib/code/parser/bitwise_or.rb +0 -13
  28. data/lib/code/parser/boolean.rb +0 -13
  29. data/lib/code/parser/call.rb +0 -183
  30. data/lib/code/parser/chained_call.rb +0 -41
  31. data/lib/code/parser/class.rb +0 -55
  32. data/lib/code/parser/code.rb +0 -20
  33. data/lib/code/parser/comments.rb +0 -46
  34. data/lib/code/parser/dictionnary.rb +0 -52
  35. data/lib/code/parser/equal.rb +0 -68
  36. data/lib/code/parser/equality.rb +0 -20
  37. data/lib/code/parser/error/syntax_error.rb +0 -36
  38. data/lib/code/parser/error.rb +0 -6
  39. data/lib/code/parser/function.rb +0 -118
  40. data/lib/code/parser/greater_than.rb +0 -13
  41. data/lib/code/parser/group.rb +0 -15
  42. data/lib/code/parser/if.rb +0 -81
  43. data/lib/code/parser/if_modifier.rb +0 -39
  44. data/lib/code/parser/list.rb +0 -20
  45. data/lib/code/parser/multiplication.rb +0 -13
  46. data/lib/code/parser/name.rb +0 -14
  47. data/lib/code/parser/negation.rb +0 -18
  48. data/lib/code/parser/not_keyword.rb +0 -26
  49. data/lib/code/parser/nothing.rb +0 -13
  50. data/lib/code/parser/number.rb +0 -57
  51. data/lib/code/parser/operation.rb +0 -65
  52. data/lib/code/parser/or_keyword.rb +0 -13
  53. data/lib/code/parser/or_operator.rb +0 -13
  54. data/lib/code/parser/power.rb +0 -33
  55. data/lib/code/parser/range.rb +0 -13
  56. data/lib/code/parser/rescue.rb +0 -38
  57. data/lib/code/parser/shift.rb +0 -13
  58. data/lib/code/parser/splat.rb +0 -35
  59. data/lib/code/parser/statement.rb +0 -9
  60. data/lib/code/parser/string.rb +0 -62
  61. data/lib/code/parser/ternary.rb +0 -73
  62. data/lib/code/parser/unary_minus.rb +0 -23
  63. data/lib/code/parser/while.rb +0 -36
  64. data/lib/code/parser.rb +0 -238
  65. data/lib/code.rb +0 -2
  66. data/lib/template/parser.rb +0 -32
  67. data/lib/template.rb +0 -2
  68. data/spec/code/parser/addition_spec.rb +0 -26
  69. data/spec/code/parser/and_operator_spec.rb +0 -26
  70. data/spec/code/parser/bitwise_and_spec.rb +0 -26
  71. data/spec/code/parser/bitwise_or_spec.rb +0 -26
  72. data/spec/code/parser/boolean_spec.rb +0 -13
  73. data/spec/code/parser/call_spec.rb +0 -52
  74. data/spec/code/parser/chained_call_spec.rb +0 -33
  75. data/spec/code/parser/class_spec.rb +0 -32
  76. data/spec/code/parser/code_spec.rb +0 -13
  77. data/spec/code/parser/dictionnary_spec.rb +0 -40
  78. data/spec/code/parser/equal_spec.rb +0 -42
  79. data/spec/code/parser/equality_spec.rb +0 -26
  80. data/spec/code/parser/function_spec.rb +0 -43
  81. data/spec/code/parser/greater_than_spec.rb +0 -26
  82. data/spec/code/parser/group_spec.rb +0 -13
  83. data/spec/code/parser/if_modifier_spec.rb +0 -26
  84. data/spec/code/parser/if_spec.rb +0 -39
  85. data/spec/code/parser/list_spec.rb +0 -27
  86. data/spec/code/parser/multiplication_spec.rb +0 -26
  87. data/spec/code/parser/negation_spec.rb +0 -13
  88. data/spec/code/parser/not_keyword_spec.rb +0 -21
  89. data/spec/code/parser/nothing_spec.rb +0 -20
  90. data/spec/code/parser/number_spec.rb +0 -24
  91. data/spec/code/parser/or_keyword_spec.rb +0 -26
  92. data/spec/code/parser/or_operator_spec.rb +0 -26
  93. data/spec/code/parser/power_spec.rb +0 -21
  94. data/spec/code/parser/range_spec.rb +0 -21
  95. data/spec/code/parser/rescue_spec.rb +0 -26
  96. data/spec/code/parser/shift_spec.rb +0 -26
  97. data/spec/code/parser/string_spec.rb +0 -28
  98. data/spec/code/parser/ternary_spec.rb +0 -26
  99. data/spec/code/parser/unary_minus_spec.rb +0 -21
  100. data/spec/code/parser/while_spec.rb +0 -32
  101. data/spec/code/parser_spec.rb +0 -13
  102. data/spec/spec_helper.rb +0 -6
  103. data/spec/template/parser_spec.rb +0 -13
@@ -1,43 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- [
7
- "()=>{}",
8
- "() => {}",
9
- "(a, b) => { add(a, b) }",
10
- "(a, b = 1, c:, d: 2, *e, **f) => { }",
11
- "(a?, b! = 1, c?:, d?: 2, *e?, *f!, **g?, **h!) => { }"
12
- ].each do |input|
13
- context input do
14
- let!(:input) { input }
15
-
16
- it { subject }
17
- end
18
- end
19
-
20
- [
21
- "(/* cool */)=>{}",
22
- "(/* cool */ a)=>{}",
23
- "(/* cool */ a:)=>{}",
24
- "(a /* cool */ )=>{}",
25
- "(a /* cool */ :)=>{}",
26
- "(a /* cool */ => 1)=>{}",
27
- "(a = /* cool */ 1)=>{}",
28
- "(a = 1 /* cool */)=>{}",
29
- "(a, /* cool */ b)=>{}",
30
- "(a, b /* cool */)=>{}",
31
- "(a, b /* cool */ = 1)=>{}",
32
- "(a, b: /* cool */)=>{}",
33
- "() /* cool */ => {}",
34
- "() => /* cool */ {}",
35
- "() => { /* cool */ }"
36
- ].each do |input|
37
- context input do
38
- let!(:input) { input }
39
-
40
- it { expect(subject.to_json).to include("cool") }
41
- end
42
- end
43
- end
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["a > b", "a > b > c", "a < b", "a >= b", "a <= b"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- [
15
- "a /* cool */ > b",
16
- "a < /* cool */ b",
17
- "a > b < c /* cool */",
18
- "a < b > /* cool */ c"
19
- ].each do |input|
20
- context input do
21
- let!(:input) { input }
22
-
23
- it { expect(subject.to_json).to include("cool") }
24
- end
25
- end
26
- end
@@ -1,13 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["()", "(true nothing)", "(true (nothing))"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
- end
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["a if b", "a if b if c", "a unless b"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- [
15
- "a /* cool */ if b",
16
- "a if /* cool */ b",
17
- "a if b if c /* cool */",
18
- "a unless b if /* cool */ c"
19
- ].each do |input|
20
- context input do
21
- let!(:input) { input }
22
-
23
- it { expect(subject.to_json).to include("cool") }
24
- end
25
- end
26
- end
@@ -1,39 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- [
7
- "if b",
8
- "if a b",
9
- "if a end",
10
- "if b a end",
11
- "if a b else c",
12
- "if a b elsif c d else e",
13
- "if a b else if c d",
14
- "if a b else unless c d"
15
- ].each do |input|
16
- context input do
17
- let!(:input) { input }
18
-
19
- it { subject }
20
- end
21
- end
22
-
23
- [
24
- "if /* cool */ a",
25
- "if a /* cool */ b",
26
- "if a b /* cool */ else c",
27
- "if a b else /* cool */ c",
28
- "if a b elsif /* cool */ c d else e",
29
- "if a b else /* cool */ if c d",
30
- "if a b else if /* cool */ c d",
31
- "if a b else unless /* cool */ c d"
32
- ].each do |input|
33
- context input do
34
- let!(:input) { input }
35
-
36
- it { expect(subject.to_json).to include("cool") }
37
- end
38
- end
39
- end
@@ -1,27 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["[]", "[1]", "[1,2]", "[1,[true]]"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- [
15
- "[ /* cool */ ]",
16
- "[ /* cool */ 1 ]",
17
- "[ 1 /* cool */ ]",
18
- "[ 1, /* cool */ 2 ]",
19
- "[ 1, 2 /* cool */ ]"
20
- ].each do |input|
21
- context input do
22
- let!(:input) { input }
23
-
24
- it { expect(subject.to_json).to include("cool") }
25
- end
26
- end
27
- end
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["a * b", "a / b", "(a / b) / c", "a / (b / c)"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- [
15
- "a /* cool */ * b",
16
- "a * /* cool */ b",
17
- "a * b * c /* cool */",
18
- "a * b * /* cool */ c"
19
- ].each do |input|
20
- context input do
21
- let!(:input) { input }
22
-
23
- it { expect(subject.to_json).to include("cool") }
24
- end
25
- end
26
- end
@@ -1,13 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- %w[!a !!a !!!!a].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
- end
@@ -1,21 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["not a", "not not a"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- ["not /* cool */ a", "not not /* cool */ a"].each do |input|
15
- context input do
16
- let!(:input) { input }
17
-
18
- it { expect(subject.to_json).to include("cool") }
19
- end
20
- end
21
- end
@@ -1,20 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- [
7
- "nothing",
8
- "null",
9
- "nil",
10
- " nothing",
11
- " \n null ",
12
- "nil \n "
13
- ].each do |input|
14
- context input do
15
- let!(:input) { input }
16
-
17
- it { subject }
18
- end
19
- end
20
- end
@@ -1,24 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- %w[
7
- 1
8
- 100
9
- 0
10
- 1_000
11
- 1.34
12
- 1_000.300_400
13
- 0x10
14
- 0o10
15
- 0b10
16
- 0b1_0000_0000
17
- ].each do |input|
18
- context input do
19
- let!(:input) { input }
20
-
21
- it { subject }
22
- end
23
- end
24
- end
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["a or b", "a and b", "a or b or c", "a and b and c"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- [
15
- "a /* cool */ and b",
16
- "a and /* cool */ b",
17
- "a or b or c /* cool */",
18
- "a or b or /* cool */ c"
19
- ].each do |input|
20
- context input do
21
- let!(:input) { input }
22
-
23
- it { expect(subject.to_json).to include("cool") }
24
- end
25
- end
26
- end
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["a || b", "a || b || c"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- [
15
- "a /* cool */ || b",
16
- "a || /* cool */ b",
17
- "a || b || c /* cool */",
18
- "a || b || /* cool */ c"
19
- ].each do |input|
20
- context input do
21
- let!(:input) { input }
22
-
23
- it { expect(subject.to_json).to include("cool") }
24
- end
25
- end
26
- end
@@ -1,21 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["a ** b", "a ** b ** c ** d"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- ["1 /* cool */ ** 2", "1 ** /* cool */ 2"].each do |input|
15
- context input do
16
- let!(:input) { input }
17
-
18
- it { expect(subject.to_json).to include("cool") }
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["a..b"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- ["a /* cool */ .. b", "a .. /* cool */ b"].each do |input|
15
- context input do
16
- let!(:input) { input }
17
-
18
- it { expect(subject.to_json).to include("cool") }
19
- end
20
- end
21
- end
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["0/0 rescue a", "0/0 rescue 0/0 rescue 'nope'"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- [
15
- "a /* cool */ rescue b",
16
- "a rescue /* cool */ b",
17
- "a rescue b /* cool */ rescue c",
18
- "a rescue b eescue /* cool */ c"
19
- ].each do |input|
20
- context input do
21
- let!(:input) { input }
22
-
23
- it { expect(subject.to_json).to include("cool") }
24
- end
25
- end
26
- end
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["a << b", "a >> b", "(a << b) >> c", "a << (b >> c)"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- [
15
- "a /* cool */ << b",
16
- "a >> /* cool */ b",
17
- "a << b >> c /* cool */",
18
- "a >> b << /* cool */ c"
19
- ].each do |input|
20
- context input do
21
- let!(:input) { input }
22
-
23
- it { expect(subject.to_json).to include("cool") }
24
- end
25
- end
26
- end
@@ -1,28 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- [
7
- "''",
8
- '""',
9
- ":a",
10
- ":even?",
11
- "'Hello Dorian'",
12
- '"Hello Dorian"',
13
- "'Hello \\' Dorian'",
14
- '"Hello \\" Dorian"',
15
- "'Hello \\{name}'",
16
- '"Hello \\{name}',
17
- "'Hello {name}'",
18
- '"Hello {name}',
19
- '"Hello \\n\\a\\{"',
20
- "'Hello \\n\\a\\{'"
21
- ].each do |input|
22
- context input do
23
- let!(:input) { input }
24
-
25
- it { subject }
26
- end
27
- end
28
- end
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["a ? b : c", "a ? b", "a ? b ? c : d : e", "a ? b ? c : d"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- [
15
- "a /* cool */ ? b : c",
16
- "a ? /* cool */ b",
17
- "a ? b /* cool */ ? c : d : e",
18
- "a ? b ? /* cool */ c : d"
19
- ].each do |input|
20
- context input do
21
- let!(:input) { input }
22
-
23
- it { expect(subject.to_json).to include("cool") }
24
- end
25
- end
26
- end
@@ -1,21 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- %w[-1 +a -+--1].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
-
14
- ["- /* cool */ 1"].each do |input|
15
- context input do
16
- let!(:input) { input }
17
-
18
- it { expect(subject.to_json).to include("cool") }
19
- end
20
- end
21
- end
@@ -1,32 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- [
7
- "while false",
8
- "while false a end",
9
- "while false a",
10
- "until true",
11
- "until true a",
12
- "until true a end"
13
- ].each do |input|
14
- context input do
15
- let!(:input) { input }
16
-
17
- it { subject }
18
- end
19
- end
20
-
21
- [
22
- "while /* cool */ a",
23
- "while a /* cool */ b",
24
- "until a b /* cool */ end"
25
- ].each do |input|
26
- context input do
27
- let!(:input) { input }
28
-
29
- it { expect(subject.to_json).to include("cool") }
30
- end
31
- end
32
- end
@@ -1,13 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Code::Parser do
4
- subject { ::Code::Parser.parse(input) }
5
-
6
- ["(1..2).any?(&:even?)"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { subject }
11
- end
12
- end
13
- end
data/spec/spec_helper.rb DELETED
@@ -1,6 +0,0 @@
1
- require_relative "../lib/template-ruby-parser"
2
- require "json"
3
-
4
- RSpec.configure do |c|
5
- c.example_status_persistence_file_path = "tmp/examples.txt"
6
- end
@@ -1,13 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ::Template::Parser do
4
- subject { ::Template::Parser.parse(input) }
5
-
6
- ["Hello", "Hello {name}", "Hello \\{name}"].each do |input|
7
- context input do
8
- let!(:input) { input }
9
-
10
- it { expect { subject }.to_not raise_error }
11
- end
12
- end
13
- end