code-ruby 0.5.0 → 0.5.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d3eab372ae2a63a19a9c6df1a8628d5dd27892de2c1976f067cf85e74b417a1
4
- data.tar.gz: 9b0a7f5d97a9a076b711e7bf8872722d46a2906f98e988f9b661a150a5dcec00
3
+ metadata.gz: 30b24e81c6643316d52f3823e675fe823a5f08a910ed6b105ecab6940bf5aa32
4
+ data.tar.gz: 3ecc5e55616b4c4cf3076dea738843b15f44ca0bbc4bfdc99b590abe34262d3e
5
5
  SHA512:
6
- metadata.gz: 72c41b22eaec2f7e43d7f9dd8355b2a797da3fc91fc82621328e2e0bad8fbe7edac71a2a2271559b09f9871cd4f8d20560ff92cdbc4f8d7cddc9882c15e32cff
7
- data.tar.gz: 36e9c2247fa179763e091499d2c4315e45bb302308e7460ac4b9fca3513bfad0ae7bfe4fbf95ea2071295b3d892874bc5b26248a2f19762c3a3d6e66a0f48812
6
+ metadata.gz: e9090649a14ca2190b29012e8f1b4ace9a6ed65622fb804e00d50e528a1e3c2208de4aed565fb2775187eba294c882ee0d5b8640a087ab8f98e001852f2e208a
7
+ data.tar.gz: e4ffa29394a688024ba94e6c27de9256cffcf86e5e7a21898d6658e634b85061e84f709be09363a06b4b0fccb9fc02e33e6540289b07a622de30da81c20a2bb1
data/.cherry.js ADDED
@@ -0,0 +1,21 @@
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/bin/publish ADDED
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ rm *.gem
6
+ git pull
7
+ git push
8
+
9
+ for file in *.gemspec
10
+ do
11
+ gem build $file
12
+ done
13
+
14
+ for file in *.gem
15
+ do
16
+ gem push $file
17
+ done
18
+
19
+ rm *.gem
@@ -3,9 +3,8 @@ require_relative "lib/template/version"
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "language-ruby"
5
5
  s.version = ::Template::Version
6
- s.summary = "A Parsing Expression Grammar (PEG)"
7
- s.description =
8
- 'A Parsing Expression Grammar (PEG) for making parsers'
6
+ s.summary = "A Parsing Expression Grammar (PEG) for making parsers"
7
+ s.description = s.summary
9
8
  s.authors = ["Dorian Marié"]
10
9
  s.email = "dorian@dorianmarie.fr"
11
10
  s.files = `git ls-files`.split($/)
@@ -55,6 +55,9 @@ class Code
55
55
  elsif operator == "<<"
56
56
  sig(arguments) { ::Code::Object }
57
57
  append(value)
58
+ elsif operator == "include?"
59
+ sig(arguments) { ::Code::Object }
60
+ include?(value)
58
61
  else
59
62
  super
60
63
  end
@@ -180,6 +183,10 @@ class Code
180
183
  self
181
184
  end
182
185
 
186
+ def include?(other)
187
+ ::Code::Object::Boolean.new(raw.include?(other))
188
+ end
189
+
183
190
  def first
184
191
  raw.first || ::Code::Object::Nothing.new
185
192
  end
data/lib/code/ruby.rb CHANGED
@@ -39,7 +39,7 @@ class Code
39
39
  )
40
40
  elsif array?
41
41
  ::Code::Object::List.new(
42
- raw.map { |element| ::Code::Ruby.to_code(key) }
42
+ raw.map { |element| ::Code::Ruby.to_code(element) }
43
43
  )
44
44
  elsif proc?
45
45
  ::Code::Object::RubyFunction.new(raw)
@@ -66,11 +66,11 @@ class Code
66
66
  raw
67
67
  .raw
68
68
  .map do |key, value|
69
- [::Code::Ruby.to_code(key), ::Code::Ruby.to_code(value)]
69
+ [::Code::Ruby.from_code(key), ::Code::Ruby.from_code(value)]
70
70
  end
71
71
  .to_h
72
72
  elsif code_list?
73
- raw.raw.map { |element| ::Code::Ruby.to_code(element) }
73
+ raw.raw.map { |element| ::Code::Ruby.from_code(element) }
74
74
  else
75
75
  raise "Unsupported class #{raw.class} for Code to Ruby conversion"
76
76
  end
data/lib/language/atom.rb CHANGED
@@ -194,7 +194,6 @@ class Language
194
194
  clone =
195
195
  Parser.new(root: self, input: parser.input, cursor: parser.cursor)
196
196
 
197
- require "colorize"
198
197
  @parent.parse(clone)
199
198
 
200
199
  if clone.output?
@@ -1,3 +1,3 @@
1
1
  require_relative "../template"
2
2
 
3
- Template::Version = Gem::Version.new("0.5.0")
3
+ Template::Version = Gem::Version.new("0.5.2")
@@ -7,6 +7,8 @@ RSpec.describe "list" do
7
7
  [
8
8
  ["[]", "[]"],
9
9
  ["[1, 2, 3]", "[1, 2, 3]"],
10
+ ["[1, 2, 3].include?(2)", "true"],
11
+ ["[1, 2, 3].include?(4)", "false"],
10
12
  ["[[true]]", "[[true]]"]
11
13
  ].each do |input, output|
12
14
  context input do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-28 00:00:00.000000000 Z
11
+ date: 2023-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -30,6 +30,7 @@ executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
+ - ".cherry.js"
33
34
  - ".editorconfig"
34
35
  - ".github/workflows/rspec.yml"
35
36
  - ".gitignore"
@@ -43,6 +44,7 @@ files:
43
44
  - TODO
44
45
  - bin/code
45
46
  - bin/format
47
+ - bin/publish
46
48
  - bin/template
47
49
  - bin/test
48
50
  - code-ruby.gemspec
@@ -234,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
236
  - !ruby/object:Gem::Version
235
237
  version: '0'
236
238
  requirements: []
237
- rubygems_version: 3.3.7
239
+ rubygems_version: 3.3.26
238
240
  signing_key:
239
241
  specification_version: 4
240
242
  summary: A programming language