aboutsummaryrefslogtreecommitdiff
path: root/test/formatters/samplecode
diff options
context:
space:
mode:
authorNolan <strake7@users.noreply.github.com>2023-12-21 19:34:11 -0800
committerGitHub <noreply@github.com>2023-12-21 20:34:11 -0700
commit93f7480c967ef9104933f6e346a562196a670d86 (patch)
tree591b26437e1c712ee38205fdd8a4fd123c092ed6 /test/formatters/samplecode
parent3aa747856a53d1108c4009b47e77b48d9f290694 (diff)
Add ruby-syntax-tree format support (#224)
Add [ruby-syntax-tree](https://github.com/ruby-syntax-tree/syntax_tree) as an available formatter. Include support for finding a [`.streerc` file](https://github.com/ruby-syntax-tree/syntax_tree#configuration). --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
Diffstat (limited to 'test/formatters/samplecode')
-rw-r--r--test/formatters/samplecode/ruby-syntax-tree/in.rb13
-rw-r--r--test/formatters/samplecode/ruby-syntax-tree/out.rb18
2 files changed, 31 insertions, 0 deletions
diff --git a/test/formatters/samplecode/ruby-syntax-tree/in.rb b/test/formatters/samplecode/ruby-syntax-tree/in.rb
new file mode 100644
index 0000000..2a2f35a
--- /dev/null
+++ b/test/formatters/samplecode/ruby-syntax-tree/in.rb
@@ -0,0 +1,13 @@
+ d=[30644250780,9003106878,
+ 30636278846,66641217692,4501790980,
+ 671_24_603036,131_61973916,66_606629_920,
+ 30642677916,30643069058];a,s=[],$*[0]
+ s.each_byte{|b|a<<("%036b"%d[b.
+ chr.to_i]).scan(/\d{6}/)}
+ a.transpose.each{ |a|
+ a.join.each_byte{\
+ |i|print i==49?\
+ ($*[1]||"#")\
+ :32.chr}
+ puts
+ }
diff --git a/test/formatters/samplecode/ruby-syntax-tree/out.rb b/test/formatters/samplecode/ruby-syntax-tree/out.rb
new file mode 100644
index 0000000..3bf1506
--- /dev/null
+++ b/test/formatters/samplecode/ruby-syntax-tree/out.rb
@@ -0,0 +1,18 @@
+d = [
+ 30_644_250_780,
+ 9_003_106_878,
+ 30_636_278_846,
+ 66_641_217_692,
+ 4_501_790_980,
+ 671_24_603036,
+ 131_61973916,
+ 66_606629_920,
+ 30_642_677_916,
+ 30_643_069_058
+]
+a, s = [], $*[0]
+s.each_byte { |b| a << ("%036b" % d[b.chr.to_i]).scan(/\d{6}/) }
+a.transpose.each do |a|
+ a.join.each_byte { |i| print i == 49 ? ($*[1] || "#") : 32.chr }
+ puts
+end