language-ruby 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +9 -0
  3. data/.github/workflows/rspec.yml +14 -0
  4. data/.gitignore +2 -0
  5. data/.prettierrc +3 -0
  6. data/.rspec +1 -0
  7. data/CHANGELOG.md +55 -0
  8. data/Gemfile +8 -0
  9. data/Gemfile.lock +48 -0
  10. data/LICENSE +7 -0
  11. data/README.md +103 -0
  12. data/TODO +17 -0
  13. data/bin/code +76 -0
  14. data/bin/format +3 -0
  15. data/bin/template +85 -0
  16. data/bin/test +17 -0
  17. data/code-ruby.gemspec +17 -0
  18. data/docs/class.code +9 -0
  19. data/docs/euler/1.template +10 -0
  20. data/docs/euler/2.template +16 -0
  21. data/docs/euler/3.template +16 -0
  22. data/docs/euler/4.template +10 -0
  23. data/docs/euler/5.template +13 -0
  24. data/docs/fibonnaci.template +14 -0
  25. data/docs/meetup.code +12 -0
  26. data/docs/precedence.template +36 -0
  27. data/docs/rain.code +22 -0
  28. data/docs/slack.code +17 -0
  29. data/docs/stripe.code +7 -0
  30. data/docs/twitter.code +9 -0
  31. data/language-ruby.gemspec +18 -0
  32. data/lib/code/error.rb +18 -0
  33. data/lib/code/node/base_10.rb +29 -0
  34. data/lib/code/node/base_16.rb +13 -0
  35. data/lib/code/node/base_2.rb +13 -0
  36. data/lib/code/node/base_8.rb +13 -0
  37. data/lib/code/node/boolean.rb +22 -0
  38. data/lib/code/node/call.rb +47 -0
  39. data/lib/code/node/call_argument.rb +21 -0
  40. data/lib/code/node/chained_call.rb +23 -0
  41. data/lib/code/node/code.rb +20 -0
  42. data/lib/code/node/decimal.rb +26 -0
  43. data/lib/code/node/dictionnary.rb +33 -0
  44. data/lib/code/node/equal.rb +34 -0
  45. data/lib/code/node/function.rb +20 -0
  46. data/lib/code/node/function_parameter.rb +31 -0
  47. data/lib/code/node/if.rb +59 -0
  48. data/lib/code/node/if_modifier.rb +47 -0
  49. data/lib/code/node/list.rb +16 -0
  50. data/lib/code/node/negation.rb +15 -0
  51. data/lib/code/node/not.rb +15 -0
  52. data/lib/code/node/nothing.rb +12 -0
  53. data/lib/code/node/number.rb +25 -0
  54. data/lib/code/node/operation.rb +38 -0
  55. data/lib/code/node/power.rb +20 -0
  56. data/lib/code/node/rescue.rb +17 -0
  57. data/lib/code/node/splat.rb +15 -0
  58. data/lib/code/node/statement.rb +59 -0
  59. data/lib/code/node/string.rb +53 -0
  60. data/lib/code/node/ternary.rb +24 -0
  61. data/lib/code/node/unary_minus.rb +15 -0
  62. data/lib/code/node/while.rb +35 -0
  63. data/lib/code/node.rb +13 -0
  64. data/lib/code/object/argument.rb +32 -0
  65. data/lib/code/object/boolean.rb +27 -0
  66. data/lib/code/object/decimal.rb +162 -0
  67. data/lib/code/object/dictionnary.rb +96 -0
  68. data/lib/code/object/function.rb +64 -0
  69. data/lib/code/object/global.rb +42 -0
  70. data/lib/code/object/integer.rb +221 -0
  71. data/lib/code/object/list.rb +200 -0
  72. data/lib/code/object/nothing.rb +23 -0
  73. data/lib/code/object/number.rb +6 -0
  74. data/lib/code/object/range.rb +146 -0
  75. data/lib/code/object/ruby_function.rb +31 -0
  76. data/lib/code/object/string.rb +88 -0
  77. data/lib/code/object.rb +197 -0
  78. data/lib/code/parser/addition.rb +21 -0
  79. data/lib/code/parser/and_operator.rb +17 -0
  80. data/lib/code/parser/bitwise_and.rb +17 -0
  81. data/lib/code/parser/bitwise_or.rb +21 -0
  82. data/lib/code/parser/boolean.rb +17 -0
  83. data/lib/code/parser/call.rb +122 -0
  84. data/lib/code/parser/chained_call.rb +47 -0
  85. data/lib/code/parser/class.rb +45 -0
  86. data/lib/code/parser/code.rb +25 -0
  87. data/lib/code/parser/dictionnary.rb +67 -0
  88. data/lib/code/parser/equal.rb +94 -0
  89. data/lib/code/parser/equality.rb +35 -0
  90. data/lib/code/parser/equality_lower.rb +9 -0
  91. data/lib/code/parser/function.rb +85 -0
  92. data/lib/code/parser/greater.rb +25 -0
  93. data/lib/code/parser/group.rb +22 -0
  94. data/lib/code/parser/if.rb +63 -0
  95. data/lib/code/parser/if_modifier.rb +55 -0
  96. data/lib/code/parser/list.rb +42 -0
  97. data/lib/code/parser/multiplication.rb +25 -0
  98. data/lib/code/parser/name.rb +101 -0
  99. data/lib/code/parser/negation.rb +30 -0
  100. data/lib/code/parser/not_keyword.rb +23 -0
  101. data/lib/code/parser/nothing.rb +22 -0
  102. data/lib/code/parser/number.rb +154 -0
  103. data/lib/code/parser/operation.rb +35 -0
  104. data/lib/code/parser/or_keyword.rb +21 -0
  105. data/lib/code/parser/or_operator.rb +17 -0
  106. data/lib/code/parser/power.rb +43 -0
  107. data/lib/code/parser/range.rb +17 -0
  108. data/lib/code/parser/rescue.rb +39 -0
  109. data/lib/code/parser/shift.rb +21 -0
  110. data/lib/code/parser/splat.rb +31 -0
  111. data/lib/code/parser/statement.rb +9 -0
  112. data/lib/code/parser/string.rb +78 -0
  113. data/lib/code/parser/ternary.rb +46 -0
  114. data/lib/code/parser/unary_minus.rb +31 -0
  115. data/lib/code/parser/while.rb +36 -0
  116. data/lib/code/parser/whitespace.rb +49 -0
  117. data/lib/code/parser.rb +19 -0
  118. data/lib/code/ruby.rb +162 -0
  119. data/lib/code-ruby.rb +10 -0
  120. data/lib/code.rb +47 -0
  121. data/lib/language/atom.rb +343 -0
  122. data/lib/language/output.rb +130 -0
  123. data/lib/language/parser/absent/present.rb +8 -0
  124. data/lib/language/parser/absent.rb +6 -0
  125. data/lib/language/parser/end_of_input.rb +6 -0
  126. data/lib/language/parser/interuption.rb +38 -0
  127. data/lib/language/parser/not_end_of_input.rb +6 -0
  128. data/lib/language/parser/str/not_found.rb +16 -0
  129. data/lib/language/parser/str.rb +6 -0
  130. data/lib/language/parser.rb +53 -0
  131. data/lib/language-ruby.rb +10 -0
  132. data/lib/language.rb +80 -0
  133. data/lib/template/node/code_part.rb +13 -0
  134. data/lib/template/node/part.rb +19 -0
  135. data/lib/template/node/template.rb +15 -0
  136. data/lib/template/node/text_part.rb +13 -0
  137. data/lib/template/node.rb +4 -0
  138. data/lib/template/parser/template.rb +39 -0
  139. data/lib/template/parser.rb +19 -0
  140. data/lib/template/version.rb +3 -0
  141. data/lib/template-ruby.rb +10 -0
  142. data/lib/template.rb +50 -0
  143. data/spec/code/addition_spec.rb +13 -0
  144. data/spec/code/and_operator_spec.rb +13 -0
  145. data/spec/code/bitwise_and_spec.rb +13 -0
  146. data/spec/code/bitwise_or_spec.rb +13 -0
  147. data/spec/code/boolean_spec.rb +13 -0
  148. data/spec/code/call_spec.rb +21 -0
  149. data/spec/code/chained_call_spec.rb +16 -0
  150. data/spec/code/dictionnary_spec.rb +17 -0
  151. data/spec/code/equal_spec.rb +26 -0
  152. data/spec/code/equality_spec.rb +13 -0
  153. data/spec/code/function_spec.rb +18 -0
  154. data/spec/code/greater_spec.rb +18 -0
  155. data/spec/code/group_spec.rb +12 -0
  156. data/spec/code/if_modifier_spec.rb +20 -0
  157. data/spec/code/if_spec.rb +25 -0
  158. data/spec/code/list_spec.rb +17 -0
  159. data/spec/code/multiplication_spec.rb +18 -0
  160. data/spec/code/negation_spec.rb +20 -0
  161. data/spec/code/not_keyword_spec.rb +13 -0
  162. data/spec/code/nothing_spec.rb +17 -0
  163. data/spec/code/number_spec.rb +22 -0
  164. data/spec/code/or_keyword_spec.rb +17 -0
  165. data/spec/code/or_operator_spec.rb +16 -0
  166. data/spec/code/parser/boolean_spec.rb +16 -0
  167. data/spec/code/parser/call_spec.rb +26 -0
  168. data/spec/code/parser/chained_call.rb +17 -0
  169. data/spec/code/parser/dictionnary_spec.rb +18 -0
  170. data/spec/code/parser/function_spec.rb +16 -0
  171. data/spec/code/parser/group_spec.rb +18 -0
  172. data/spec/code/parser/list_spec.rb +18 -0
  173. data/spec/code/parser/number_spec.rb +12 -0
  174. data/spec/code/parser/string_spec.rb +21 -0
  175. data/spec/code/parser_spec.rb +23 -0
  176. data/spec/code/power_spec.rb +13 -0
  177. data/spec/code/range_spec.rb +16 -0
  178. data/spec/code/rescue_spec.rb +13 -0
  179. data/spec/code/shift_spec.rb +13 -0
  180. data/spec/code/splat_spec.rb +13 -0
  181. data/spec/code/string_spec.rb +25 -0
  182. data/spec/code/ternary_spec.rb +18 -0
  183. data/spec/code/unary_minus_spec.rb +13 -0
  184. data/spec/code/while_spec.rb +18 -0
  185. data/spec/spec_helper.rb +6 -0
  186. data/template-ruby.gemspec +19 -0
  187. metadata +284 -0
metadata ADDED
@@ -0,0 +1,284 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: language-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Dorian Marié
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-11-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: zeitwerk
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2'
27
+ description: A Parsing Expression Grammar (PEG) for making parsers
28
+ email: dorian@dorianmarie.fr
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ".editorconfig"
34
+ - ".github/workflows/rspec.yml"
35
+ - ".gitignore"
36
+ - ".prettierrc"
37
+ - ".rspec"
38
+ - CHANGELOG.md
39
+ - Gemfile
40
+ - Gemfile.lock
41
+ - LICENSE
42
+ - README.md
43
+ - TODO
44
+ - bin/code
45
+ - bin/format
46
+ - bin/template
47
+ - bin/test
48
+ - code-ruby.gemspec
49
+ - docs/class.code
50
+ - docs/euler/1.template
51
+ - docs/euler/2.template
52
+ - docs/euler/3.template
53
+ - docs/euler/4.template
54
+ - docs/euler/5.template
55
+ - docs/fibonnaci.template
56
+ - docs/meetup.code
57
+ - docs/precedence.template
58
+ - docs/rain.code
59
+ - docs/slack.code
60
+ - docs/stripe.code
61
+ - docs/twitter.code
62
+ - language-ruby.gemspec
63
+ - lib/code-ruby.rb
64
+ - lib/code.rb
65
+ - lib/code/error.rb
66
+ - lib/code/node.rb
67
+ - lib/code/node/base_10.rb
68
+ - lib/code/node/base_16.rb
69
+ - lib/code/node/base_2.rb
70
+ - lib/code/node/base_8.rb
71
+ - lib/code/node/boolean.rb
72
+ - lib/code/node/call.rb
73
+ - lib/code/node/call_argument.rb
74
+ - lib/code/node/chained_call.rb
75
+ - lib/code/node/code.rb
76
+ - lib/code/node/decimal.rb
77
+ - lib/code/node/dictionnary.rb
78
+ - lib/code/node/equal.rb
79
+ - lib/code/node/function.rb
80
+ - lib/code/node/function_parameter.rb
81
+ - lib/code/node/if.rb
82
+ - lib/code/node/if_modifier.rb
83
+ - lib/code/node/list.rb
84
+ - lib/code/node/negation.rb
85
+ - lib/code/node/not.rb
86
+ - lib/code/node/nothing.rb
87
+ - lib/code/node/number.rb
88
+ - lib/code/node/operation.rb
89
+ - lib/code/node/power.rb
90
+ - lib/code/node/rescue.rb
91
+ - lib/code/node/splat.rb
92
+ - lib/code/node/statement.rb
93
+ - lib/code/node/string.rb
94
+ - lib/code/node/ternary.rb
95
+ - lib/code/node/unary_minus.rb
96
+ - lib/code/node/while.rb
97
+ - lib/code/object.rb
98
+ - lib/code/object/argument.rb
99
+ - lib/code/object/boolean.rb
100
+ - lib/code/object/decimal.rb
101
+ - lib/code/object/dictionnary.rb
102
+ - lib/code/object/function.rb
103
+ - lib/code/object/global.rb
104
+ - lib/code/object/integer.rb
105
+ - lib/code/object/list.rb
106
+ - lib/code/object/nothing.rb
107
+ - lib/code/object/number.rb
108
+ - lib/code/object/range.rb
109
+ - lib/code/object/ruby_function.rb
110
+ - lib/code/object/string.rb
111
+ - lib/code/parser.rb
112
+ - lib/code/parser/addition.rb
113
+ - lib/code/parser/and_operator.rb
114
+ - lib/code/parser/bitwise_and.rb
115
+ - lib/code/parser/bitwise_or.rb
116
+ - lib/code/parser/boolean.rb
117
+ - lib/code/parser/call.rb
118
+ - lib/code/parser/chained_call.rb
119
+ - lib/code/parser/class.rb
120
+ - lib/code/parser/code.rb
121
+ - lib/code/parser/dictionnary.rb
122
+ - lib/code/parser/equal.rb
123
+ - lib/code/parser/equality.rb
124
+ - lib/code/parser/equality_lower.rb
125
+ - lib/code/parser/function.rb
126
+ - lib/code/parser/greater.rb
127
+ - lib/code/parser/group.rb
128
+ - lib/code/parser/if.rb
129
+ - lib/code/parser/if_modifier.rb
130
+ - lib/code/parser/list.rb
131
+ - lib/code/parser/multiplication.rb
132
+ - lib/code/parser/name.rb
133
+ - lib/code/parser/negation.rb
134
+ - lib/code/parser/not_keyword.rb
135
+ - lib/code/parser/nothing.rb
136
+ - lib/code/parser/number.rb
137
+ - lib/code/parser/operation.rb
138
+ - lib/code/parser/or_keyword.rb
139
+ - lib/code/parser/or_operator.rb
140
+ - lib/code/parser/power.rb
141
+ - lib/code/parser/range.rb
142
+ - lib/code/parser/rescue.rb
143
+ - lib/code/parser/shift.rb
144
+ - lib/code/parser/splat.rb
145
+ - lib/code/parser/statement.rb
146
+ - lib/code/parser/string.rb
147
+ - lib/code/parser/ternary.rb
148
+ - lib/code/parser/unary_minus.rb
149
+ - lib/code/parser/while.rb
150
+ - lib/code/parser/whitespace.rb
151
+ - lib/code/ruby.rb
152
+ - lib/language-ruby.rb
153
+ - lib/language.rb
154
+ - lib/language/atom.rb
155
+ - lib/language/output.rb
156
+ - lib/language/parser.rb
157
+ - lib/language/parser/absent.rb
158
+ - lib/language/parser/absent/present.rb
159
+ - lib/language/parser/end_of_input.rb
160
+ - lib/language/parser/interuption.rb
161
+ - lib/language/parser/not_end_of_input.rb
162
+ - lib/language/parser/str.rb
163
+ - lib/language/parser/str/not_found.rb
164
+ - lib/template-ruby.rb
165
+ - lib/template.rb
166
+ - lib/template/node.rb
167
+ - lib/template/node/code_part.rb
168
+ - lib/template/node/part.rb
169
+ - lib/template/node/template.rb
170
+ - lib/template/node/text_part.rb
171
+ - lib/template/parser.rb
172
+ - lib/template/parser/template.rb
173
+ - lib/template/version.rb
174
+ - spec/code/addition_spec.rb
175
+ - spec/code/and_operator_spec.rb
176
+ - spec/code/bitwise_and_spec.rb
177
+ - spec/code/bitwise_or_spec.rb
178
+ - spec/code/boolean_spec.rb
179
+ - spec/code/call_spec.rb
180
+ - spec/code/chained_call_spec.rb
181
+ - spec/code/dictionnary_spec.rb
182
+ - spec/code/equal_spec.rb
183
+ - spec/code/equality_spec.rb
184
+ - spec/code/function_spec.rb
185
+ - spec/code/greater_spec.rb
186
+ - spec/code/group_spec.rb
187
+ - spec/code/if_modifier_spec.rb
188
+ - spec/code/if_spec.rb
189
+ - spec/code/list_spec.rb
190
+ - spec/code/multiplication_spec.rb
191
+ - spec/code/negation_spec.rb
192
+ - spec/code/not_keyword_spec.rb
193
+ - spec/code/nothing_spec.rb
194
+ - spec/code/number_spec.rb
195
+ - spec/code/or_keyword_spec.rb
196
+ - spec/code/or_operator_spec.rb
197
+ - spec/code/parser/boolean_spec.rb
198
+ - spec/code/parser/call_spec.rb
199
+ - spec/code/parser/chained_call.rb
200
+ - spec/code/parser/dictionnary_spec.rb
201
+ - spec/code/parser/function_spec.rb
202
+ - spec/code/parser/group_spec.rb
203
+ - spec/code/parser/list_spec.rb
204
+ - spec/code/parser/number_spec.rb
205
+ - spec/code/parser/string_spec.rb
206
+ - spec/code/parser_spec.rb
207
+ - spec/code/power_spec.rb
208
+ - spec/code/range_spec.rb
209
+ - spec/code/rescue_spec.rb
210
+ - spec/code/shift_spec.rb
211
+ - spec/code/splat_spec.rb
212
+ - spec/code/string_spec.rb
213
+ - spec/code/ternary_spec.rb
214
+ - spec/code/unary_minus_spec.rb
215
+ - spec/code/while_spec.rb
216
+ - spec/spec_helper.rb
217
+ - template-ruby.gemspec
218
+ homepage: https://github.com/dorianmariefr/template-ruby
219
+ licenses:
220
+ - MIT
221
+ metadata: {}
222
+ post_install_message:
223
+ rdoc_options: []
224
+ require_paths:
225
+ - lib
226
+ required_ruby_version: !ruby/object:Gem::Requirement
227
+ requirements:
228
+ - - ">="
229
+ - !ruby/object:Gem::Version
230
+ version: '0'
231
+ required_rubygems_version: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - ">="
234
+ - !ruby/object:Gem::Version
235
+ version: '0'
236
+ requirements: []
237
+ rubygems_version: 3.3.7
238
+ signing_key:
239
+ specification_version: 4
240
+ summary: A Parsing Expression Grammar (PEG)
241
+ test_files:
242
+ - spec/code/addition_spec.rb
243
+ - spec/code/and_operator_spec.rb
244
+ - spec/code/bitwise_and_spec.rb
245
+ - spec/code/bitwise_or_spec.rb
246
+ - spec/code/boolean_spec.rb
247
+ - spec/code/call_spec.rb
248
+ - spec/code/chained_call_spec.rb
249
+ - spec/code/dictionnary_spec.rb
250
+ - spec/code/equal_spec.rb
251
+ - spec/code/equality_spec.rb
252
+ - spec/code/function_spec.rb
253
+ - spec/code/greater_spec.rb
254
+ - spec/code/group_spec.rb
255
+ - spec/code/if_modifier_spec.rb
256
+ - spec/code/if_spec.rb
257
+ - spec/code/list_spec.rb
258
+ - spec/code/multiplication_spec.rb
259
+ - spec/code/negation_spec.rb
260
+ - spec/code/not_keyword_spec.rb
261
+ - spec/code/nothing_spec.rb
262
+ - spec/code/number_spec.rb
263
+ - spec/code/or_keyword_spec.rb
264
+ - spec/code/or_operator_spec.rb
265
+ - spec/code/parser/boolean_spec.rb
266
+ - spec/code/parser/call_spec.rb
267
+ - spec/code/parser/chained_call.rb
268
+ - spec/code/parser/dictionnary_spec.rb
269
+ - spec/code/parser/function_spec.rb
270
+ - spec/code/parser/group_spec.rb
271
+ - spec/code/parser/list_spec.rb
272
+ - spec/code/parser/number_spec.rb
273
+ - spec/code/parser/string_spec.rb
274
+ - spec/code/parser_spec.rb
275
+ - spec/code/power_spec.rb
276
+ - spec/code/range_spec.rb
277
+ - spec/code/rescue_spec.rb
278
+ - spec/code/shift_spec.rb
279
+ - spec/code/splat_spec.rb
280
+ - spec/code/string_spec.rb
281
+ - spec/code/ternary_spec.rb
282
+ - spec/code/unary_minus_spec.rb
283
+ - spec/code/while_spec.rb
284
+ - spec/spec_helper.rb