language-ruby 0.5.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -4
- data/language-ruby.gemspec +3 -3
- data/lib/language/atom/any.rb +8 -0
- data/lib/language/atom/repeat.rb +15 -0
- data/lib/language/atom.rb +25 -42
- data/lib/language/output.rb +13 -11
- data/lib/language/parser/absent/present.rb +2 -0
- data/lib/language/parser/absent.rb +2 -0
- data/lib/language/parser/end_of_input.rb +2 -0
- data/lib/language/parser/interuption.rb +2 -0
- data/lib/language/parser/not_end_of_input.rb +2 -0
- data/lib/language/parser/str/not_found.rb +2 -0
- data/lib/language/parser/str.rb +2 -0
- data/lib/language/parser.rb +10 -10
- data/lib/language/version.rb +3 -0
- data/lib/language-ruby.rb +0 -5
- data/lib/language.rb +9 -7
- data/spec/spec_helper.rb +1 -6
- metadata +7 -221
- data/.cherry.js +0 -21
- data/.editorconfig +0 -9
- data/.github/workflows/rspec.yml +0 -14
- data/.gitignore +0 -2
- data/.prettierrc +0 -3
- data/.rspec +0 -1
- data/.tool-versions +0 -1
- data/CHANGELOG.md +0 -55
- data/Gemfile.lock +0 -49
- data/LICENSE +0 -7
- data/README.md +0 -103
- data/TODO +0 -17
- data/bin/code +0 -76
- data/bin/format +0 -3
- data/bin/publish +0 -19
- data/bin/template +0 -85
- data/bin/test +0 -17
- data/code-ruby.gemspec +0 -17
- data/docs/class.code +0 -9
- data/docs/euler/1.template +0 -10
- data/docs/euler/2.template +0 -16
- data/docs/euler/3.template +0 -16
- data/docs/euler/4.template +0 -10
- data/docs/euler/5.template +0 -13
- data/docs/fibonnaci.template +0 -14
- data/docs/meetup.code +0 -12
- data/docs/precedence.template +0 -36
- data/docs/rain.code +0 -22
- data/docs/slack.code +0 -17
- data/docs/stripe.code +0 -7
- data/docs/twitter.code +0 -9
- data/lib/code/error.rb +0 -18
- data/lib/code/node/base_10.rb +0 -29
- data/lib/code/node/base_16.rb +0 -13
- data/lib/code/node/base_2.rb +0 -13
- data/lib/code/node/base_8.rb +0 -13
- data/lib/code/node/boolean.rb +0 -22
- data/lib/code/node/call.rb +0 -47
- data/lib/code/node/call_argument.rb +0 -21
- data/lib/code/node/chained_call.rb +0 -23
- data/lib/code/node/code.rb +0 -20
- data/lib/code/node/decimal.rb +0 -26
- data/lib/code/node/dictionnary.rb +0 -33
- data/lib/code/node/equal.rb +0 -34
- data/lib/code/node/function.rb +0 -20
- data/lib/code/node/function_parameter.rb +0 -31
- data/lib/code/node/if.rb +0 -59
- data/lib/code/node/if_modifier.rb +0 -47
- data/lib/code/node/list.rb +0 -16
- data/lib/code/node/negation.rb +0 -15
- data/lib/code/node/not.rb +0 -15
- data/lib/code/node/nothing.rb +0 -12
- data/lib/code/node/number.rb +0 -25
- data/lib/code/node/operation.rb +0 -38
- data/lib/code/node/power.rb +0 -20
- data/lib/code/node/rescue.rb +0 -17
- data/lib/code/node/splat.rb +0 -15
- data/lib/code/node/statement.rb +0 -59
- data/lib/code/node/string.rb +0 -53
- data/lib/code/node/ternary.rb +0 -24
- data/lib/code/node/unary_minus.rb +0 -15
- data/lib/code/node/while.rb +0 -35
- data/lib/code/node.rb +0 -13
- data/lib/code/object/argument.rb +0 -32
- data/lib/code/object/boolean.rb +0 -27
- data/lib/code/object/decimal.rb +0 -162
- data/lib/code/object/dictionnary.rb +0 -96
- data/lib/code/object/function.rb +0 -64
- data/lib/code/object/global.rb +0 -42
- data/lib/code/object/integer.rb +0 -221
- data/lib/code/object/list.rb +0 -207
- data/lib/code/object/nothing.rb +0 -23
- data/lib/code/object/number.rb +0 -6
- data/lib/code/object/range.rb +0 -146
- data/lib/code/object/ruby_function.rb +0 -31
- data/lib/code/object/string.rb +0 -102
- data/lib/code/object.rb +0 -197
- data/lib/code/parser/addition.rb +0 -21
- data/lib/code/parser/and_operator.rb +0 -17
- data/lib/code/parser/bitwise_and.rb +0 -17
- data/lib/code/parser/bitwise_or.rb +0 -21
- data/lib/code/parser/boolean.rb +0 -17
- data/lib/code/parser/call.rb +0 -122
- data/lib/code/parser/chained_call.rb +0 -47
- data/lib/code/parser/class.rb +0 -45
- data/lib/code/parser/code.rb +0 -25
- data/lib/code/parser/dictionnary.rb +0 -67
- data/lib/code/parser/equal.rb +0 -94
- data/lib/code/parser/equality.rb +0 -35
- data/lib/code/parser/equality_lower.rb +0 -9
- data/lib/code/parser/function.rb +0 -85
- data/lib/code/parser/greater.rb +0 -25
- data/lib/code/parser/group.rb +0 -22
- data/lib/code/parser/if.rb +0 -63
- data/lib/code/parser/if_modifier.rb +0 -55
- data/lib/code/parser/list.rb +0 -42
- data/lib/code/parser/multiplication.rb +0 -25
- data/lib/code/parser/name.rb +0 -107
- data/lib/code/parser/negation.rb +0 -30
- data/lib/code/parser/not_keyword.rb +0 -23
- data/lib/code/parser/nothing.rb +0 -22
- data/lib/code/parser/number.rb +0 -154
- data/lib/code/parser/operation.rb +0 -35
- data/lib/code/parser/or_keyword.rb +0 -21
- data/lib/code/parser/or_operator.rb +0 -17
- data/lib/code/parser/power.rb +0 -43
- data/lib/code/parser/range.rb +0 -17
- data/lib/code/parser/rescue.rb +0 -39
- data/lib/code/parser/shift.rb +0 -21
- data/lib/code/parser/splat.rb +0 -31
- data/lib/code/parser/statement.rb +0 -9
- data/lib/code/parser/string.rb +0 -78
- data/lib/code/parser/ternary.rb +0 -46
- data/lib/code/parser/unary_minus.rb +0 -31
- data/lib/code/parser/while.rb +0 -36
- data/lib/code/parser/whitespace.rb +0 -49
- data/lib/code/parser.rb +0 -19
- data/lib/code/ruby.rb +0 -174
- data/lib/code-ruby.rb +0 -10
- data/lib/code.rb +0 -47
- data/lib/template/node/code_part.rb +0 -13
- data/lib/template/node/part.rb +0 -19
- data/lib/template/node/template.rb +0 -15
- data/lib/template/node/text_part.rb +0 -13
- data/lib/template/node.rb +0 -4
- data/lib/template/parser/template.rb +0 -39
- data/lib/template/parser.rb +0 -19
- data/lib/template/version.rb +0 -3
- data/lib/template-ruby.rb +0 -10
- data/lib/template.rb +0 -50
- data/spec/code/addition_spec.rb +0 -13
- data/spec/code/and_operator_spec.rb +0 -13
- data/spec/code/bitwise_and_spec.rb +0 -13
- data/spec/code/bitwise_or_spec.rb +0 -13
- data/spec/code/boolean_spec.rb +0 -13
- data/spec/code/call_spec.rb +0 -21
- data/spec/code/chained_call_spec.rb +0 -16
- data/spec/code/code_spec.rb +0 -11
- data/spec/code/dictionnary_spec.rb +0 -17
- data/spec/code/equal_spec.rb +0 -26
- data/spec/code/equality_spec.rb +0 -13
- data/spec/code/function_spec.rb +0 -18
- data/spec/code/greater_spec.rb +0 -18
- data/spec/code/group_spec.rb +0 -12
- data/spec/code/if_modifier_spec.rb +0 -20
- data/spec/code/if_spec.rb +0 -25
- data/spec/code/list_spec.rb +0 -19
- data/spec/code/multiplication_spec.rb +0 -18
- data/spec/code/negation_spec.rb +0 -20
- data/spec/code/not_keyword_spec.rb +0 -13
- data/spec/code/nothing_spec.rb +0 -17
- data/spec/code/number_spec.rb +0 -22
- data/spec/code/or_keyword_spec.rb +0 -17
- data/spec/code/or_operator_spec.rb +0 -16
- data/spec/code/parser/boolean_spec.rb +0 -16
- data/spec/code/parser/call_spec.rb +0 -26
- data/spec/code/parser/chained_call.rb +0 -17
- data/spec/code/parser/dictionnary_spec.rb +0 -18
- data/spec/code/parser/function_spec.rb +0 -16
- data/spec/code/parser/group_spec.rb +0 -18
- data/spec/code/parser/list_spec.rb +0 -18
- data/spec/code/parser/number_spec.rb +0 -12
- data/spec/code/parser/string_spec.rb +0 -21
- data/spec/code/parser_spec.rb +0 -23
- data/spec/code/power_spec.rb +0 -13
- data/spec/code/range_spec.rb +0 -16
- data/spec/code/rescue_spec.rb +0 -13
- data/spec/code/shift_spec.rb +0 -13
- data/spec/code/splat_spec.rb +0 -13
- data/spec/code/string_spec.rb +0 -27
- data/spec/code/ternary_spec.rb +0 -18
- data/spec/code/unary_minus_spec.rb +0 -13
- data/spec/code/while_spec.rb +0 -18
- data/template-ruby.gemspec +0 -19
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: language-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -30,131 +30,13 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
-
- ".cherry.js"
|
34
|
-
- ".editorconfig"
|
35
|
-
- ".github/workflows/rspec.yml"
|
36
|
-
- ".gitignore"
|
37
|
-
- ".prettierrc"
|
38
|
-
- ".rspec"
|
39
|
-
- ".tool-versions"
|
40
|
-
- CHANGELOG.md
|
41
33
|
- Gemfile
|
42
|
-
- Gemfile.lock
|
43
|
-
- LICENSE
|
44
|
-
- README.md
|
45
|
-
- TODO
|
46
|
-
- bin/code
|
47
|
-
- bin/format
|
48
|
-
- bin/publish
|
49
|
-
- bin/template
|
50
|
-
- bin/test
|
51
|
-
- code-ruby.gemspec
|
52
|
-
- docs/class.code
|
53
|
-
- docs/euler/1.template
|
54
|
-
- docs/euler/2.template
|
55
|
-
- docs/euler/3.template
|
56
|
-
- docs/euler/4.template
|
57
|
-
- docs/euler/5.template
|
58
|
-
- docs/fibonnaci.template
|
59
|
-
- docs/meetup.code
|
60
|
-
- docs/precedence.template
|
61
|
-
- docs/rain.code
|
62
|
-
- docs/slack.code
|
63
|
-
- docs/stripe.code
|
64
|
-
- docs/twitter.code
|
65
34
|
- language-ruby.gemspec
|
66
|
-
- lib/code-ruby.rb
|
67
|
-
- lib/code.rb
|
68
|
-
- lib/code/error.rb
|
69
|
-
- lib/code/node.rb
|
70
|
-
- lib/code/node/base_10.rb
|
71
|
-
- lib/code/node/base_16.rb
|
72
|
-
- lib/code/node/base_2.rb
|
73
|
-
- lib/code/node/base_8.rb
|
74
|
-
- lib/code/node/boolean.rb
|
75
|
-
- lib/code/node/call.rb
|
76
|
-
- lib/code/node/call_argument.rb
|
77
|
-
- lib/code/node/chained_call.rb
|
78
|
-
- lib/code/node/code.rb
|
79
|
-
- lib/code/node/decimal.rb
|
80
|
-
- lib/code/node/dictionnary.rb
|
81
|
-
- lib/code/node/equal.rb
|
82
|
-
- lib/code/node/function.rb
|
83
|
-
- lib/code/node/function_parameter.rb
|
84
|
-
- lib/code/node/if.rb
|
85
|
-
- lib/code/node/if_modifier.rb
|
86
|
-
- lib/code/node/list.rb
|
87
|
-
- lib/code/node/negation.rb
|
88
|
-
- lib/code/node/not.rb
|
89
|
-
- lib/code/node/nothing.rb
|
90
|
-
- lib/code/node/number.rb
|
91
|
-
- lib/code/node/operation.rb
|
92
|
-
- lib/code/node/power.rb
|
93
|
-
- lib/code/node/rescue.rb
|
94
|
-
- lib/code/node/splat.rb
|
95
|
-
- lib/code/node/statement.rb
|
96
|
-
- lib/code/node/string.rb
|
97
|
-
- lib/code/node/ternary.rb
|
98
|
-
- lib/code/node/unary_minus.rb
|
99
|
-
- lib/code/node/while.rb
|
100
|
-
- lib/code/object.rb
|
101
|
-
- lib/code/object/argument.rb
|
102
|
-
- lib/code/object/boolean.rb
|
103
|
-
- lib/code/object/decimal.rb
|
104
|
-
- lib/code/object/dictionnary.rb
|
105
|
-
- lib/code/object/function.rb
|
106
|
-
- lib/code/object/global.rb
|
107
|
-
- lib/code/object/integer.rb
|
108
|
-
- lib/code/object/list.rb
|
109
|
-
- lib/code/object/nothing.rb
|
110
|
-
- lib/code/object/number.rb
|
111
|
-
- lib/code/object/range.rb
|
112
|
-
- lib/code/object/ruby_function.rb
|
113
|
-
- lib/code/object/string.rb
|
114
|
-
- lib/code/parser.rb
|
115
|
-
- lib/code/parser/addition.rb
|
116
|
-
- lib/code/parser/and_operator.rb
|
117
|
-
- lib/code/parser/bitwise_and.rb
|
118
|
-
- lib/code/parser/bitwise_or.rb
|
119
|
-
- lib/code/parser/boolean.rb
|
120
|
-
- lib/code/parser/call.rb
|
121
|
-
- lib/code/parser/chained_call.rb
|
122
|
-
- lib/code/parser/class.rb
|
123
|
-
- lib/code/parser/code.rb
|
124
|
-
- lib/code/parser/dictionnary.rb
|
125
|
-
- lib/code/parser/equal.rb
|
126
|
-
- lib/code/parser/equality.rb
|
127
|
-
- lib/code/parser/equality_lower.rb
|
128
|
-
- lib/code/parser/function.rb
|
129
|
-
- lib/code/parser/greater.rb
|
130
|
-
- lib/code/parser/group.rb
|
131
|
-
- lib/code/parser/if.rb
|
132
|
-
- lib/code/parser/if_modifier.rb
|
133
|
-
- lib/code/parser/list.rb
|
134
|
-
- lib/code/parser/multiplication.rb
|
135
|
-
- lib/code/parser/name.rb
|
136
|
-
- lib/code/parser/negation.rb
|
137
|
-
- lib/code/parser/not_keyword.rb
|
138
|
-
- lib/code/parser/nothing.rb
|
139
|
-
- lib/code/parser/number.rb
|
140
|
-
- lib/code/parser/operation.rb
|
141
|
-
- lib/code/parser/or_keyword.rb
|
142
|
-
- lib/code/parser/or_operator.rb
|
143
|
-
- lib/code/parser/power.rb
|
144
|
-
- lib/code/parser/range.rb
|
145
|
-
- lib/code/parser/rescue.rb
|
146
|
-
- lib/code/parser/shift.rb
|
147
|
-
- lib/code/parser/splat.rb
|
148
|
-
- lib/code/parser/statement.rb
|
149
|
-
- lib/code/parser/string.rb
|
150
|
-
- lib/code/parser/ternary.rb
|
151
|
-
- lib/code/parser/unary_minus.rb
|
152
|
-
- lib/code/parser/while.rb
|
153
|
-
- lib/code/parser/whitespace.rb
|
154
|
-
- lib/code/ruby.rb
|
155
35
|
- lib/language-ruby.rb
|
156
36
|
- lib/language.rb
|
157
37
|
- lib/language/atom.rb
|
38
|
+
- lib/language/atom/any.rb
|
39
|
+
- lib/language/atom/repeat.rb
|
158
40
|
- lib/language/output.rb
|
159
41
|
- lib/language/parser.rb
|
160
42
|
- lib/language/parser/absent.rb
|
@@ -164,62 +46,9 @@ files:
|
|
164
46
|
- lib/language/parser/not_end_of_input.rb
|
165
47
|
- lib/language/parser/str.rb
|
166
48
|
- lib/language/parser/str/not_found.rb
|
167
|
-
- lib/
|
168
|
-
- lib/template.rb
|
169
|
-
- lib/template/node.rb
|
170
|
-
- lib/template/node/code_part.rb
|
171
|
-
- lib/template/node/part.rb
|
172
|
-
- lib/template/node/template.rb
|
173
|
-
- lib/template/node/text_part.rb
|
174
|
-
- lib/template/parser.rb
|
175
|
-
- lib/template/parser/template.rb
|
176
|
-
- lib/template/version.rb
|
177
|
-
- spec/code/addition_spec.rb
|
178
|
-
- spec/code/and_operator_spec.rb
|
179
|
-
- spec/code/bitwise_and_spec.rb
|
180
|
-
- spec/code/bitwise_or_spec.rb
|
181
|
-
- spec/code/boolean_spec.rb
|
182
|
-
- spec/code/call_spec.rb
|
183
|
-
- spec/code/chained_call_spec.rb
|
184
|
-
- spec/code/code_spec.rb
|
185
|
-
- spec/code/dictionnary_spec.rb
|
186
|
-
- spec/code/equal_spec.rb
|
187
|
-
- spec/code/equality_spec.rb
|
188
|
-
- spec/code/function_spec.rb
|
189
|
-
- spec/code/greater_spec.rb
|
190
|
-
- spec/code/group_spec.rb
|
191
|
-
- spec/code/if_modifier_spec.rb
|
192
|
-
- spec/code/if_spec.rb
|
193
|
-
- spec/code/list_spec.rb
|
194
|
-
- spec/code/multiplication_spec.rb
|
195
|
-
- spec/code/negation_spec.rb
|
196
|
-
- spec/code/not_keyword_spec.rb
|
197
|
-
- spec/code/nothing_spec.rb
|
198
|
-
- spec/code/number_spec.rb
|
199
|
-
- spec/code/or_keyword_spec.rb
|
200
|
-
- spec/code/or_operator_spec.rb
|
201
|
-
- spec/code/parser/boolean_spec.rb
|
202
|
-
- spec/code/parser/call_spec.rb
|
203
|
-
- spec/code/parser/chained_call.rb
|
204
|
-
- spec/code/parser/dictionnary_spec.rb
|
205
|
-
- spec/code/parser/function_spec.rb
|
206
|
-
- spec/code/parser/group_spec.rb
|
207
|
-
- spec/code/parser/list_spec.rb
|
208
|
-
- spec/code/parser/number_spec.rb
|
209
|
-
- spec/code/parser/string_spec.rb
|
210
|
-
- spec/code/parser_spec.rb
|
211
|
-
- spec/code/power_spec.rb
|
212
|
-
- spec/code/range_spec.rb
|
213
|
-
- spec/code/rescue_spec.rb
|
214
|
-
- spec/code/shift_spec.rb
|
215
|
-
- spec/code/splat_spec.rb
|
216
|
-
- spec/code/string_spec.rb
|
217
|
-
- spec/code/ternary_spec.rb
|
218
|
-
- spec/code/unary_minus_spec.rb
|
219
|
-
- spec/code/while_spec.rb
|
49
|
+
- lib/language/version.rb
|
220
50
|
- spec/spec_helper.rb
|
221
|
-
|
222
|
-
homepage: https://github.com/dorianmariefr/template-ruby
|
51
|
+
homepage: https://github.com/dorianmariefr/language-ruby
|
223
52
|
licenses:
|
224
53
|
- MIT
|
225
54
|
metadata: {}
|
@@ -238,52 +67,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
67
|
- !ruby/object:Gem::Version
|
239
68
|
version: '0'
|
240
69
|
requirements: []
|
241
|
-
rubygems_version: 3.
|
70
|
+
rubygems_version: 3.4.14
|
242
71
|
signing_key:
|
243
72
|
specification_version: 4
|
244
73
|
summary: A Parsing Expression Grammar (PEG) for making parsers
|
245
74
|
test_files:
|
246
|
-
- spec/code/addition_spec.rb
|
247
|
-
- spec/code/and_operator_spec.rb
|
248
|
-
- spec/code/bitwise_and_spec.rb
|
249
|
-
- spec/code/bitwise_or_spec.rb
|
250
|
-
- spec/code/boolean_spec.rb
|
251
|
-
- spec/code/call_spec.rb
|
252
|
-
- spec/code/chained_call_spec.rb
|
253
|
-
- spec/code/code_spec.rb
|
254
|
-
- spec/code/dictionnary_spec.rb
|
255
|
-
- spec/code/equal_spec.rb
|
256
|
-
- spec/code/equality_spec.rb
|
257
|
-
- spec/code/function_spec.rb
|
258
|
-
- spec/code/greater_spec.rb
|
259
|
-
- spec/code/group_spec.rb
|
260
|
-
- spec/code/if_modifier_spec.rb
|
261
|
-
- spec/code/if_spec.rb
|
262
|
-
- spec/code/list_spec.rb
|
263
|
-
- spec/code/multiplication_spec.rb
|
264
|
-
- spec/code/negation_spec.rb
|
265
|
-
- spec/code/not_keyword_spec.rb
|
266
|
-
- spec/code/nothing_spec.rb
|
267
|
-
- spec/code/number_spec.rb
|
268
|
-
- spec/code/or_keyword_spec.rb
|
269
|
-
- spec/code/or_operator_spec.rb
|
270
|
-
- spec/code/parser/boolean_spec.rb
|
271
|
-
- spec/code/parser/call_spec.rb
|
272
|
-
- spec/code/parser/chained_call.rb
|
273
|
-
- spec/code/parser/dictionnary_spec.rb
|
274
|
-
- spec/code/parser/function_spec.rb
|
275
|
-
- spec/code/parser/group_spec.rb
|
276
|
-
- spec/code/parser/list_spec.rb
|
277
|
-
- spec/code/parser/number_spec.rb
|
278
|
-
- spec/code/parser/string_spec.rb
|
279
|
-
- spec/code/parser_spec.rb
|
280
|
-
- spec/code/power_spec.rb
|
281
|
-
- spec/code/range_spec.rb
|
282
|
-
- spec/code/rescue_spec.rb
|
283
|
-
- spec/code/shift_spec.rb
|
284
|
-
- spec/code/splat_spec.rb
|
285
|
-
- spec/code/string_spec.rb
|
286
|
-
- spec/code/ternary_spec.rb
|
287
|
-
- spec/code/unary_minus_spec.rb
|
288
|
-
- spec/code/while_spec.rb
|
289
75
|
- spec/spec_helper.rb
|
data/.cherry.js
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
project_name: 'dorianmariefr/template-ruby',
|
3
|
-
metrics: [
|
4
|
-
{
|
5
|
-
name: 'todo',
|
6
|
-
pattern: /TODO:/i,
|
7
|
-
},
|
8
|
-
{
|
9
|
-
name: 'fixme',
|
10
|
-
pattern: /FIXME:/i,
|
11
|
-
},
|
12
|
-
{
|
13
|
-
name: 'rubocop',
|
14
|
-
pattern: /rubocop:disable/,
|
15
|
-
},
|
16
|
-
{
|
17
|
-
name: 'eslint',
|
18
|
-
pattern: /eslint-disable/,
|
19
|
-
},
|
20
|
-
],
|
21
|
-
}
|
data/.editorconfig
DELETED
data/.github/workflows/rspec.yml
DELETED
data/.gitignore
DELETED
data/.prettierrc
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--require spec_helper
|
data/.tool-versions
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby 3.1.3
|
data/CHANGELOG.md
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
# Changelog
|
2
|
-
|
3
|
-
All notable changes to this project will be documented in this file.
|
4
|
-
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
-
|
8
|
-
## 0.4.0 / 2022-10-21
|
9
|
-
|
10
|
-
- Rewrite of how functions are called internally (no more `public_send`)
|
11
|
-
- Call ruby functions from template/code
|
12
|
-
|
13
|
-
## 0.3.1 / 2022-10-13
|
14
|
-
|
15
|
-
- Fix Zeitwerk auto-loading issue
|
16
|
-
|
17
|
-
## 0.3.0 / 2022-10-10
|
18
|
-
|
19
|
-
- `bin/template` accepts `--timeout` (or `-t`) parameter
|
20
|
-
- Adds `bin/code` with same options as `bin/template`
|
21
|
-
- Prevent loose syntax like `{ a: }`, `[1,,,]` and `()`
|
22
|
-
- Change precedence of defined? (to allow `defined?(name) ? name : nothing`)
|
23
|
-
- Updates parsers to allow `while false end == nothing`
|
24
|
-
- String interpolations like `"1 + 1 = {1 + 1}"`
|
25
|
-
- `context(:name)` to get a function without calling it for instance
|
26
|
-
- `.to_string` on all objects
|
27
|
-
- `1 + "a"` and `"a" + 1.0` for instance now convert to strings
|
28
|
-
- `Dictionnary#each` e.g. `{ a: 1 }.each { |k, v| print(k) }`
|
29
|
-
- Fix context duplication issue that was preventing implementation of recursive
|
30
|
-
functions like Fibonacci
|
31
|
-
|
32
|
-
## 0.2.4 / 2022-08-02
|
33
|
-
|
34
|
-
- Add method `String#*`, e.g. `{"Dorian " \* 2}" -> "Dorian Dorian "
|
35
|
-
- Add executable to gem, e.g. `template --help`
|
36
|
-
|
37
|
-
## 0.2.3 / 2022-08-31
|
38
|
-
|
39
|
-
- Add default timeout for code and template parsing and evaluation
|
40
|
-
|
41
|
-
## 0.2.2 / 2022-08-31
|
42
|
-
|
43
|
-
- Fix parsing error when the template is empty, e.g. ""
|
44
|
-
|
45
|
-
## 0.2.1 / 2022-08-31
|
46
|
-
|
47
|
-
- Fix parsing error on empty code like `Hello {`
|
48
|
-
|
49
|
-
## 0.2.0 / 2022-08-30
|
50
|
-
|
51
|
-
- Programming language capable of solving the first 5 Project Euler problems
|
52
|
-
|
53
|
-
## 0.1.0 / 2022-07-28
|
54
|
-
|
55
|
-
- Initial version with interpolation
|
data/Gemfile.lock
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/dorianmariefr/syntax_tree.git
|
3
|
-
revision: f7c9dc36a3d60c90a8d2411f123913b37319dc11
|
4
|
-
specs:
|
5
|
-
syntax_tree (5.0.1)
|
6
|
-
prettier_print (>= 1.1.0)
|
7
|
-
|
8
|
-
PATH
|
9
|
-
remote: .
|
10
|
-
specs:
|
11
|
-
code-ruby (0.5.4)
|
12
|
-
zeitwerk (~> 2)
|
13
|
-
template-ruby (0.5.4)
|
14
|
-
zeitwerk (~> 2)
|
15
|
-
|
16
|
-
GEM
|
17
|
-
remote: https://rubygems.org/
|
18
|
-
specs:
|
19
|
-
diff-lcs (1.5.0)
|
20
|
-
prettier_print (1.1.0)
|
21
|
-
rspec (3.12.0)
|
22
|
-
rspec-core (~> 3.12.0)
|
23
|
-
rspec-expectations (~> 3.12.0)
|
24
|
-
rspec-mocks (~> 3.12.0)
|
25
|
-
rspec-core (3.12.0)
|
26
|
-
rspec-support (~> 3.12.0)
|
27
|
-
rspec-expectations (3.12.0)
|
28
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
-
rspec-support (~> 3.12.0)
|
30
|
-
rspec-mocks (3.12.0)
|
31
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.12.0)
|
33
|
-
rspec-support (3.12.0)
|
34
|
-
ruby-prof (1.4.3)
|
35
|
-
zeitwerk (2.6.6)
|
36
|
-
|
37
|
-
PLATFORMS
|
38
|
-
arm64-darwin-21
|
39
|
-
arm64-darwin-22
|
40
|
-
|
41
|
-
DEPENDENCIES
|
42
|
-
code-ruby!
|
43
|
-
rspec
|
44
|
-
ruby-prof
|
45
|
-
syntax_tree!
|
46
|
-
template-ruby!
|
47
|
-
|
48
|
-
BUNDLED WITH
|
49
|
-
2.3.18
|
data/LICENSE
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
Copyright 2022 Dorian Marié <dorian@dorianmarie.fr>
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
-
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
-
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
# Template
|
2
|
-
|
3
|
-
[![RSpec](https://github.com/dorianmariefr/template-ruby/actions/workflows/rspec.yml/badge.svg)](https://github.com/dorianmariefr/template-ruby/actions/workflows/rspec.yml)
|
4
|
-
|
5
|
-
See [templatelang.com](https://templatelang.com) for the full documentation and
|
6
|
-
live code editing.
|
7
|
-
|
8
|
-
## The programming language
|
9
|
-
|
10
|
-
Hi, I'm [Dorian Marié](https://dorianmarie.fr), I created Template to let users of my websites provide templates to customize their experience.
|
11
|
-
|
12
|
-
Template is meant to be:
|
13
|
-
|
14
|
-
- **Simple**: `Hello` and `Hello {name}`
|
15
|
-
- **Safe**: Can be provided user input
|
16
|
-
- **Powerful**: Functions, object-oriented, built-in methods
|
17
|
-
|
18
|
-
Template is currently written in Ruby and embeddable as a Ruby gem.
|
19
|
-
|
20
|
-
## Install
|
21
|
-
|
22
|
-
### As a command line tool:
|
23
|
-
|
24
|
-
```bash
|
25
|
-
$ gem install template-ruby
|
26
|
-
$ template --input "Hello {name}" --context '{ name: "Dorian" }'
|
27
|
-
Hello Dorian
|
28
|
-
$ template --input "1 + 2 = {1 + 2}"
|
29
|
-
1 + 2 = 3
|
30
|
-
```
|
31
|
-
|
32
|
-
### As a Ruby gem:
|
33
|
-
|
34
|
-
In a `Gemfile`:
|
35
|
-
|
36
|
-
```ruby
|
37
|
-
gem "template-ruby"
|
38
|
-
```
|
39
|
-
|
40
|
-
Then `$ bundle install`
|
41
|
-
|
42
|
-
Then you can use Template like:
|
43
|
-
|
44
|
-
```ruby
|
45
|
-
Template.render("Hello {name}", '{ name: "Dorian" }')
|
46
|
-
# => "Hello Dorian"
|
47
|
-
Template.render("1 + 2 = {1 + 2}")
|
48
|
-
# => "1 + 2 = 3"
|
49
|
-
Template.render(input, context, io: StringIO.new, timeout: 10)
|
50
|
-
```
|
51
|
-
|
52
|
-
The context is a sub-language called Code, you can use it like:
|
53
|
-
|
54
|
-
```ruby
|
55
|
-
Code.evaluate("1 + 2") # => 3
|
56
|
-
```
|
57
|
-
|
58
|
-
## Future work
|
59
|
-
|
60
|
-
- Extend standard library
|
61
|
-
- Global methods from Ruby, e.g. `{markdown "**bold**"}`
|
62
|
-
- Object methods from Ruby, e.g. `{"**bold**".markdown}`
|
63
|
-
- Classes, e.g. `{class User end}`
|
64
|
-
- Write JavaScript version
|
65
|
-
- Write Crystal version
|
66
|
-
|
67
|
-
## Contributing
|
68
|
-
|
69
|
-
Feel free to open [issues](https://github.com/dorianmariefr/template-ruby/issues),
|
70
|
-
and [pull requests](https://github.com/dorianmariefr/template-ruby/pulls).
|
71
|
-
|
72
|
-
To develop locally:
|
73
|
-
|
74
|
-
```text
|
75
|
-
$ git clone https://github.com/dorianmariefr/template-ruby
|
76
|
-
$ cd template-ruby
|
77
|
-
$ bundle
|
78
|
-
$ rspec
|
79
|
-
$ bin/template -i docs/...
|
80
|
-
```
|
81
|
-
|
82
|
-
## Credits
|
83
|
-
|
84
|
-
Thanks to [thoughtbot](https://thoughtbot.com) who let me work on this programming
|
85
|
-
language as a Friday project.
|
86
|
-
|
87
|
-
Thanks to [Kaspar Schiess](https://github.com/kschiess) who made
|
88
|
-
[Parslet](https://kschiess.github.io/parslet/), the gem that helped me write the parser.
|
89
|
-
|
90
|
-
Inspiration from [Ruby](https://www.ruby-lang.org/en/) and
|
91
|
-
[Liquid](https://shopify.github.io/liquid/).
|
92
|
-
|
93
|
-
## License
|
94
|
-
|
95
|
-
MIT
|
96
|
-
|
97
|
-
Copyright 2022 Dorian Marié <dorian@dorianmarie.fr>
|
98
|
-
|
99
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
100
|
-
|
101
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
102
|
-
|
103
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/TODO
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
- Class
|
2
|
-
- Function parameters regular splat *args
|
3
|
-
- Function parameters keyword splat **kargs
|
4
|
-
- Function parameters block &block
|
5
|
-
- Block parameters regular splat *args
|
6
|
-
- Block parameters keyword splat **kargs
|
7
|
-
- Block parameters block &block
|
8
|
-
- Dictionnary regular splat { *args }
|
9
|
-
- Dictionnary keyword splat { **kargs }
|
10
|
-
- Dictionnary block { &block }
|
11
|
-
- Dictionnary expand name { user } and { user: }
|
12
|
-
- Rescue with exception name, rescue Code::Undefined
|
13
|
-
- Rescue with exception catched, rescue => e
|
14
|
-
- begin end
|
15
|
-
- begin rescue end
|
16
|
-
- begin rescue ensure end
|
17
|
-
- begin rescue else end
|
data/bin/code
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "optparse"
|
4
|
-
require_relative "../lib/template-ruby"
|
5
|
-
|
6
|
-
options = { timeout: 0, profile: false }
|
7
|
-
|
8
|
-
OptionParser
|
9
|
-
.new do |opts|
|
10
|
-
opts.banner = "Usage: bin/code [options]"
|
11
|
-
|
12
|
-
opts.on(
|
13
|
-
"-i INPUT",
|
14
|
-
"--input=INPUT",
|
15
|
-
"Input in the code language (String or File)"
|
16
|
-
) do |input|
|
17
|
-
input = File.read(input) if File.exists?(input)
|
18
|
-
|
19
|
-
options[:input] = input
|
20
|
-
end
|
21
|
-
|
22
|
-
opts.on(
|
23
|
-
"-c CONTEXT",
|
24
|
-
"--context=CONTEXT",
|
25
|
-
"Context in the code language (String or File)"
|
26
|
-
) do |context|
|
27
|
-
context = File.read(context) if File.exists?(context)
|
28
|
-
|
29
|
-
options[:context] = context
|
30
|
-
end
|
31
|
-
|
32
|
-
opts.on("-p", "--parse", "Get parser results for input") do |parse|
|
33
|
-
options[:parse] = parse
|
34
|
-
end
|
35
|
-
|
36
|
-
opts.on(
|
37
|
-
"-t TIMEOUT",
|
38
|
-
"--timeout=TIMEOUT",
|
39
|
-
"Set timeout in seconds"
|
40
|
-
) { |timeout| options[:timeout] = timeout.to_f }
|
41
|
-
|
42
|
-
opts.on(
|
43
|
-
"--profile",
|
44
|
-
"Profile Ruby code"
|
45
|
-
) do |timeout|
|
46
|
-
require "ruby-prof"
|
47
|
-
options[:profile] = true
|
48
|
-
end
|
49
|
-
end
|
50
|
-
.parse!
|
51
|
-
|
52
|
-
input = options.fetch(:input, "")
|
53
|
-
context = options.fetch(:context, "")
|
54
|
-
|
55
|
-
if options[:profile]
|
56
|
-
RubyProf.start
|
57
|
-
end
|
58
|
-
|
59
|
-
if options[:parse]
|
60
|
-
pp ::Code::Parser.parse(input).to_raw
|
61
|
-
else
|
62
|
-
print(
|
63
|
-
Code.evaluate(
|
64
|
-
input,
|
65
|
-
context,
|
66
|
-
io: $stdout,
|
67
|
-
timeout: options[:timeout]
|
68
|
-
).to_s
|
69
|
-
)
|
70
|
-
end
|
71
|
-
|
72
|
-
if options[:profile]
|
73
|
-
result = RubyProf.stop
|
74
|
-
printer = RubyProf::FlatPrinter.new(result)
|
75
|
-
printer.print($stdout)
|
76
|
-
end
|
data/bin/format
DELETED