sexpistol 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b217eeb6f0ed5af77c53a0a192ff94c6fc7a4d46486431e7745eac08760bfdc1
4
+ data.tar.gz: 73dc1ddefb3af80b10f3556bc284a16fdfef1fff8807f39b4cd219dff5d8c4ce
5
+ SHA512:
6
+ metadata.gz: d2972b16e20179addf61a4190a00e40acbf974e70b54c49839cf220400600c70c57835e7190024d4019ee52d8233cbe78f28435b87e4988caf758e355ce4f208
7
+ data.tar.gz: 7d812ca13d3785640dd06d8e84cb77fe41d2a6dc94fbdd14f6b54ef1c8f4fe36620ddc4eaa7d7bcdf772f98e875d67bc565ba86d31eab144754d8be99b9d03f9
@@ -0,0 +1,30 @@
1
+ name: build
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - uses: actions/checkout@v1
11
+
12
+ - name: Install Ruby (2.6)
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+
17
+ - name: Setup Code Climate test-reporter
18
+ run: |
19
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
20
+ chmod +x ./cc-test-reporter
21
+ ./cc-test-reporter before-build
22
+ - name: Build and test with RSpec
23
+ run: |
24
+ gem install bundler
25
+ bundle install --jobs 4 --retry 3
26
+ bundle exec rspec
27
+ - name: Publish code coverage
28
+ run: |
29
+ export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
30
+ ./cc-test-reporter after-build --id ${{secrets.CC_TEST_REPORTER_ID}} --coverage-input-type simplecov
data/.gitignore CHANGED
@@ -1 +1,3 @@
1
- *.gem
1
+ *.gem
2
+ .DS_Store
3
+ coverage
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format progress
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,27 @@
1
+ Metrics/BlockLength:
2
+ IgnoredMethods: ['describe', 'context']
3
+
4
+ Style/SymbolProc:
5
+ IgnoredMethods: ['configure']
6
+
7
+ AllCops:
8
+ SuggestExtensions: false
9
+ NewCops: enable
10
+
11
+ Lint/BooleanSymbol:
12
+ Enabled: false
13
+
14
+ Style/Documentation:
15
+ Enabled: false
16
+
17
+ Metrics/AbcSize:
18
+ Max: 20
19
+
20
+ Metrics/MethodLength:
21
+ Max: 15
22
+
23
+ Metrics/CyclomaticComplexity:
24
+ Max: 10
25
+
26
+ Gemspec/RequireMFA:
27
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,61 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sexpistol (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ diff-lcs (1.5.0)
11
+ docile (1.3.5)
12
+ json (2.6.1)
13
+ parallel (1.21.0)
14
+ parser (3.1.0.0)
15
+ ast (~> 2.4.1)
16
+ rainbow (3.0.0)
17
+ regexp_parser (2.2.0)
18
+ rexml (3.2.5)
19
+ rspec (3.10.0)
20
+ rspec-core (~> 3.10.0)
21
+ rspec-expectations (~> 3.10.0)
22
+ rspec-mocks (~> 3.10.0)
23
+ rspec-core (3.10.1)
24
+ rspec-support (~> 3.10.0)
25
+ rspec-expectations (3.10.1)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.10.0)
28
+ rspec-mocks (3.10.2)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.10.0)
31
+ rspec-support (3.10.3)
32
+ rubocop (1.24.1)
33
+ parallel (~> 1.10)
34
+ parser (>= 3.0.0.0)
35
+ rainbow (>= 2.2.2, < 4.0)
36
+ regexp_parser (>= 1.8, < 3.0)
37
+ rexml
38
+ rubocop-ast (>= 1.15.1, < 2.0)
39
+ ruby-progressbar (~> 1.7)
40
+ unicode-display_width (>= 1.4.0, < 3.0)
41
+ rubocop-ast (1.15.1)
42
+ parser (>= 3.0.1.1)
43
+ ruby-progressbar (1.11.0)
44
+ simplecov (0.17.1)
45
+ docile (~> 1.1)
46
+ json (>= 1.8, < 3)
47
+ simplecov-html (~> 0.10.0)
48
+ simplecov-html (0.10.2)
49
+ unicode-display_width (2.1.0)
50
+
51
+ PLATFORMS
52
+ ruby
53
+
54
+ DEPENDENCIES
55
+ rspec (~> 3.2)
56
+ rubocop
57
+ sexpistol!
58
+ simplecov (~> 0.17.1)
59
+
60
+ BUNDLED WITH
61
+ 2.3.4
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Aaron Gough (http://thingsaaronmade.com/)
1
+ Copyright (c) 2022 Aaron Gough (http://thingsaaronmade.com/)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md ADDED
@@ -0,0 +1,135 @@
1
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
2
+ ![Actions Status](https://github.com/aarongough/sexpistol/actions/workflows/ruby.yml/badge.svg)
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/a5ce9269a7b23614103c/maintainability)](https://codeclimate.com/github/aarongough/sexpistol/maintainability)
4
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/a5ce9269a7b23614103c/test_coverage)](https://codeclimate.com/github/aarongough/sexpistol/test_coverage)
5
+ [![Gem Version](https://badge.fury.io/rb/sexpistol.svg)](https://badge.fury.io/rb/sexpistol)
6
+
7
+ # Sexpistol
8
+
9
+ Sexpistol is a very fast and easy-to-use library for parsing S-Expressions in Ruby. Sexpistol takes an S-Expression in string form and turns it into a native Ruby data structure made up of nested sets of arrays.
10
+
11
+ ### Example:
12
+
13
+ ```scheme
14
+ (define test (lambda () (
15
+ (print "Hello world!\n")
16
+ (print 1)
17
+ (print 9.01)
18
+ (print 2.0e10)
19
+ (print (+ 10 12 13))
20
+ )))
21
+ ```
22
+
23
+ would be parsed by Sexpistol like so:
24
+
25
+ ```ruby
26
+ [:define, :test, [:lambda, [], [
27
+ [:print, "Hello world!\n"],
28
+ [:print, 1],
29
+ [:print, 9.01],
30
+ [:print, 2.0e10],
31
+ [:print, [:+, 10, 12, 13]]
32
+ ]]]
33
+ ```
34
+
35
+ ### Usage:
36
+
37
+ ```ruby
38
+ # Parse an s-expression
39
+ ast = Sexpistol.parse("(string (to (parse)))")
40
+ #=> [:string, [:to, [:parse]]]
41
+
42
+ # Change the representation
43
+ ast[1][0] = :is
44
+ ast[1][1][0] = :parsed
45
+ #=> [:string, [:is, [:parsed]]]
46
+
47
+ # Turn the array structure back into an S-Expression
48
+ Sexpistol.to_sexp(ast)
49
+ #=> "(string (is (parsed)))"
50
+ ```
51
+
52
+ ### API:
53
+ ```ruby
54
+ Sexpistol.parse(string, parse_ruby_keyword_literals: false)
55
+ # Parse an s-expression given as a string. Optionally convert
56
+ # ruby keyword literals to their native Ruby equivalents.
57
+
58
+ Sexpistol.to_sexp(structure, scheme_compatability: false)
59
+ # Output a nested set of arrays as an s-expression. Optionally
60
+ # output `true, false, nil` as their Scheme literal equivalents.
61
+
62
+ Sexpistol.convert_ruby_keyword_literals(data)
63
+ # Recursively maps over a nested array structure and converts
64
+ # any instances of :nil, :true, :false to their native Ruby equivalents.
65
+
66
+ Sexpistol.convert_scheme_literals(data)
67
+ # Converts Ruby literals to their equivalent Scheme literals
68
+
69
+ Sexpistol.recursive_map(data, &block)
70
+ # Recursively map over a nested set of arrays, applying the block
71
+ # to each item and returning the result.
72
+ ```
73
+
74
+ ### Type mappings:
75
+
76
+ Sexpistol supports all of the standard datatypes and converts them directly to their Ruby equivalents:
77
+
78
+ - Lists (a b c) -> `[:a, :b, :c]`
79
+ - Integers (1 2 3) -> `[1, 2, 3]`
80
+ - Floats (1.0 42.9 3e6 1.2e2) -> `[1.0, 42.9, 3e6, 1.2e2]`
81
+ - Strings ("\t\"Hello world!\"\n") -> `["\t\"Hello world!\"\n"]`
82
+ - Symbols (symbol symbol? + - a+ e$, etc...) -> `[:symbol, :symbol?, :+, :-, :a+, :'e$', :'etc...']`
83
+
84
+ Sexpistol also supports mapping the Ruby keyword literals (`nil`, `true`, `false`) to their native Ruby types, although this is disabled by default for compatibility. To enable it use `parse_ruby_keyword_literals: true`, eg:
85
+
86
+ ```ruby
87
+ Sexpistol.parse("(nil false true)")
88
+ #=> [:nil, :false, :true]
89
+
90
+ Sexpistol.parse("(nil false true)", parse_ruby_keyword_literals: true)
91
+ #=> [nil, false, true]
92
+ ```
93
+
94
+ ### Scheme compatibility:
95
+
96
+ Sexpistol strives to be compatible with Scheme-style S-Expressions. Sexpistol can generate Scheme compatible external representations when the 'scheme_compatability' option is set to true:
97
+
98
+ ```ruby
99
+ Sexpistol.to_sexp([true, false, nil])
100
+ #=> "(true false nil)"
101
+
102
+ Sexpistol.to_sexp([true, false, nil], scheme_compatability: true)
103
+ #=> "(#t #f ())"
104
+ ```
105
+
106
+ ### Installation:
107
+
108
+ Add Sexpistol to your gemfile:
109
+
110
+ ```ruby
111
+ gem 'sexpistol', '~>0.10.0'
112
+ ```
113
+
114
+ And then execute:
115
+
116
+ ```
117
+ bundle install
118
+ ```
119
+
120
+ Or install it manually by entering the following at your command line:
121
+
122
+ ```
123
+ gem install sexpistol
124
+ ```
125
+
126
+ ### Contributing:
127
+
128
+ Contributions are always welcome! Please create a pull request that clearly outlines the work you've done. Make sure your changes include updating or adding relevant tests, and use [Rubocop](https://github.com/rubocop/rubocop) to make sure your additions adhere to the same style as the rest of the project!
129
+
130
+ ### Author & Credits:
131
+
132
+ Author: [Aaron Gough](mailto:aaron@aarongough.com)
133
+ Contributors: [Shane Hanna](http://github.com/shanna)
134
+
135
+ Copyright © 2022 [Aaron Gough](http://thingsaaronmade.com/), released under the MIT license
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'strscan'
4
+
5
+ class Sexpistol
6
+ class Parser < StringScanner
7
+ PARANTHESES = /[()]/.freeze
8
+ STRING = /"([^"\\]|\\.)*"/.freeze
9
+ FLOAT = /[\-+]? [0-9]+ ((e[0-9]+) | (\.[0-9]+(e[0-9]+)?)) [\s()]/x.freeze
10
+ INTEGER = /[\-+]?[0-9]+[\s()]/.freeze
11
+ SYMBOL = /[^0-9()\s]+[^()\s]*/.freeze
12
+
13
+ def initialize(string)
14
+ raise 'String given is not an s-expression' if string.strip[0] != '('
15
+ raise 'Invalid s-expression' if string.count('(') != string.count(')')
16
+
17
+ super(string.strip)
18
+ end
19
+
20
+ def parse(level = 0, exp = [])
21
+ until eos?
22
+ case token = fetch_token
23
+ when ')' then break
24
+ when '(' then exp << parse(level + 1)
25
+ when String, Integer, Float, Symbol then exp << token
26
+ end
27
+ end
28
+
29
+ if level.zero?
30
+ exp = exp.first if exp.first.is_a?(Array) && exp.length == 1
31
+ exp = Sexpistol::SExpressionArray.new(exp) if exp.all? { |item| item.is_a?(Array) }
32
+ end
33
+
34
+ exp
35
+ end
36
+
37
+ def fetch_token
38
+ skip(/\s+/)
39
+
40
+ return matched if scan(PARANTHESES)
41
+ return matched.undump if scan(STRING)
42
+ return matched.to_f if scan(FLOAT)
43
+ return matched.to_i if scan(INTEGER)
44
+ return matched.to_sym if scan(SYMBOL)
45
+
46
+ raise "Invalid token at position #{pos} near '#{scan(/.{0,20}/)}'."
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Sexpistol
4
+ class SExpressionArray < Array
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Sexpistol
4
+ VERSION = '0.1.0'
5
+ end
data/lib/sexpistol.rb CHANGED
@@ -1 +1,53 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), 'sexpistol', 'sexpistol.rb'))
1
+ # frozen_string_literal: true
2
+
3
+ require 'sexpistol/parser'
4
+ require 'sexpistol/version'
5
+ require 'sexpistol/s_expression_array'
6
+
7
+ class Sexpistol
8
+ def self.parse(string, parse_ruby_keyword_literals: false)
9
+ tree = Sexpistol::Parser.new(string).parse
10
+ return convert_ruby_keyword_literals(tree) if parse_ruby_keyword_literals
11
+
12
+ tree
13
+ end
14
+
15
+ def self.to_sexp(data, scheme_compatability: false)
16
+ data = convert_scheme_literals(data) if scheme_compatability
17
+
18
+ return "\"#{data}\"" if data.is_a?(String)
19
+ return data.to_s unless data.is_a?(Array)
20
+
21
+ if data.is_a?(SExpressionArray)
22
+ data.map { |x| to_sexp(x, scheme_compatability: scheme_compatability) }.join(' ')
23
+ else
24
+ "(#{data.map { |x| to_sexp(x, scheme_compatability: scheme_compatability) }.join(' ')})"
25
+ end
26
+ end
27
+
28
+ def self.convert_ruby_keyword_literals(expression)
29
+ recursive_map(expression) do |x|
30
+ case x
31
+ when :nil then nil
32
+ when :true then true
33
+ when :false then false
34
+ else x
35
+ end
36
+ end
37
+ end
38
+
39
+ def self.convert_scheme_literals(data)
40
+ case data
41
+ when nil then []
42
+ when true then :'#t'
43
+ when false then :'#f'
44
+ else data
45
+ end
46
+ end
47
+
48
+ def self.recursive_map(data, &block)
49
+ return data.map { |x| recursive_map(x, &block) } if data.is_a?(Array)
50
+
51
+ block.call(data)
52
+ end
53
+ end
data/sexpistol.gemspec CHANGED
@@ -1,69 +1,31 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
1
+ # frozen_string_literal: true
5
2
 
6
- Gem::Specification.new do |s|
7
- s.name = %q{sexpistol}
8
- s.version = "0.0.4"
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'sexpistol/version'
9
6
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Aaron Gough"]
12
- s.date = %q{2010-10-11}
13
- s.description = %q{Sexpistol is an easy-to-use S-Expression parser for Ruby. It is fast and has no dependencies.}
14
- s.email = %q{aaron@aarongough.com}
15
- s.extra_rdoc_files = [
16
- "MIT-LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".gitignore",
21
- "MIT-LICENSE",
22
- "README.rdoc",
23
- "Rakefile",
24
- "VERSION",
25
- "lib/sexpistol.rb",
26
- "lib/sexpistol/sexpistol.rb",
27
- "sexpistol.gemspec",
28
- "test/performance/benchmark_test.rb",
29
- "test/setup/test_unit_extensions.rb",
30
- "test/test_helper.rb",
31
- "test/unit/float_literal_test.rb",
32
- "test/unit/integer_literal_test.rb",
33
- "test/unit/ruby_keyword_literals_test.rb",
34
- "test/unit/scheme_compatability_test.rb",
35
- "test/unit/string_literal_test.rb",
36
- "test/unit/structure_test.rb",
37
- "test/unit/symbol_test.rb",
38
- "test/unit/to_sexp_test.rb"
39
- ]
40
- s.homepage = %q{http://github.com/aarongough/sexpistol}
41
- s.rdoc_options = ["--charset=UTF-8", "--line-numbers", "--inline-source"]
42
- s.require_paths = ["lib"]
43
- s.rubygems_version = %q{1.3.7}
44
- s.summary = %q{An S-Expression Parser Library for Ruby}
45
- s.test_files = [
46
- "test/performance/benchmark_test.rb",
47
- "test/setup/test_unit_extensions.rb",
48
- "test/test_helper.rb",
49
- "test/unit/float_literal_test.rb",
50
- "test/unit/integer_literal_test.rb",
51
- "test/unit/ruby_keyword_literals_test.rb",
52
- "test/unit/scheme_compatability_test.rb",
53
- "test/unit/string_literal_test.rb",
54
- "test/unit/structure_test.rb",
55
- "test/unit/symbol_test.rb",
56
- "test/unit/to_sexp_test.rb"
57
- ]
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'sexpistol'
9
+ spec.version = Sexpistol::VERSION
10
+ spec.authors = ['Aaron Gough']
11
+ spec.email = ['aaron@aarongough.com']
58
12
 
59
- if s.respond_to? :specification_version then
60
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
61
- s.specification_version = 3
13
+ spec.summary = 'Sexpistol is an easy-to-use S-Expression parser for Ruby. It is fast and has no dependencies.'
14
+ spec.description = 'Sexpistol is an easy-to-use S-Expression parser for Ruby. It is fast and has no dependencies.'
15
+ spec.homepage = 'https://github.com/aarongough/sexpistol'
16
+ spec.license = 'MIT'
62
17
 
63
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
64
- else
65
- end
66
- else
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
67
20
  end
68
- end
69
21
 
22
+ spec.bindir = 'exe'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.required_ruby_version = '>= 2.5.0'
27
+
28
+ spec.add_development_dependency 'rspec', '~> 3.2'
29
+ spec.add_development_dependency 'rubocop'
30
+ spec.add_development_dependency 'simplecov', '~> 0.17.1'
31
+ end
metadata CHANGED
@@ -1,95 +1,100 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sexpistol
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 4
9
- version: 0.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Aaron Gough
13
- autorequire:
14
- bindir: bin
8
+ autorequire:
9
+ bindir: exe
15
10
  cert_chain: []
16
-
17
- date: 2010-10-11 00:00:00 -04:00
18
- default_executable:
19
- dependencies: []
20
-
21
- description: Sexpistol is an easy-to-use S-Expression parser for Ruby. It is fast and has no dependencies.
22
- email: aaron@aarongough.com
11
+ date: 2022-01-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.17.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.17.1
55
+ description: Sexpistol is an easy-to-use S-Expression parser for Ruby. It is fast
56
+ and has no dependencies.
57
+ email:
58
+ - aaron@aarongough.com
23
59
  executables: []
24
-
25
60
  extensions: []
26
-
27
- extra_rdoc_files:
28
- - MIT-LICENSE
29
- - README.rdoc
30
- files:
31
- - .gitignore
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".github/workflows/ruby.yml"
64
+ - ".gitignore"
65
+ - ".rspec"
66
+ - ".rubocop.yml"
67
+ - Gemfile
68
+ - Gemfile.lock
32
69
  - MIT-LICENSE
33
- - README.rdoc
34
- - Rakefile
35
- - VERSION
70
+ - README.md
36
71
  - lib/sexpistol.rb
37
- - lib/sexpistol/sexpistol.rb
72
+ - lib/sexpistol/parser.rb
73
+ - lib/sexpistol/s_expression_array.rb
74
+ - lib/sexpistol/version.rb
38
75
  - sexpistol.gemspec
39
- - test/performance/benchmark_test.rb
40
- - test/setup/test_unit_extensions.rb
41
- - test/test_helper.rb
42
- - test/unit/float_literal_test.rb
43
- - test/unit/integer_literal_test.rb
44
- - test/unit/ruby_keyword_literals_test.rb
45
- - test/unit/scheme_compatability_test.rb
46
- - test/unit/string_literal_test.rb
47
- - test/unit/structure_test.rb
48
- - test/unit/symbol_test.rb
49
- - test/unit/to_sexp_test.rb
50
- has_rdoc: true
51
- homepage: http://github.com/aarongough/sexpistol
52
- licenses: []
53
-
54
- post_install_message:
55
- rdoc_options:
56
- - --charset=UTF-8
57
- - --line-numbers
58
- - --inline-source
59
- require_paths:
76
+ homepage: https://github.com/aarongough/sexpistol
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
60
83
  - lib
61
- required_ruby_version: !ruby/object:Gem::Requirement
62
- none: false
63
- requirements:
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
64
86
  - - ">="
65
- - !ruby/object:Gem::Version
66
- segments:
67
- - 0
68
- version: "0"
69
- required_rubygems_version: !ruby/object:Gem::Requirement
70
- none: false
71
- requirements:
87
+ - !ruby/object:Gem::Version
88
+ version: 2.5.0
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
72
91
  - - ">="
73
- - !ruby/object:Gem::Version
74
- segments:
75
- - 0
76
- version: "0"
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
77
94
  requirements: []
78
-
79
- rubyforge_project:
80
- rubygems_version: 1.3.7
81
- signing_key:
82
- specification_version: 3
83
- summary: An S-Expression Parser Library for Ruby
84
- test_files:
85
- - test/performance/benchmark_test.rb
86
- - test/setup/test_unit_extensions.rb
87
- - test/test_helper.rb
88
- - test/unit/float_literal_test.rb
89
- - test/unit/integer_literal_test.rb
90
- - test/unit/ruby_keyword_literals_test.rb
91
- - test/unit/scheme_compatability_test.rb
92
- - test/unit/string_literal_test.rb
93
- - test/unit/structure_test.rb
94
- - test/unit/symbol_test.rb
95
- - test/unit/to_sexp_test.rb
95
+ rubygems_version: 3.0.8
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: Sexpistol is an easy-to-use S-Expression parser for Ruby. It is fast and
99
+ has no dependencies.
100
+ test_files: []
data/README.rdoc DELETED
@@ -1,73 +0,0 @@
1
- = Sexpistol
2
-
3
- Sexpistol is a simple library for parsing S-Expressions in Ruby. Sexpistol takes an S-Expression and turns it into a native Ruby data structure made up of nested sets of arrays.
4
-
5
- === Example
6
-
7
- (define test (lambda () (
8
- (print "Hello world!\n")
9
- (print 1)
10
- (print 9.01)
11
- (print 2.0e10)
12
- (print (+ 10 12 13))
13
- )))
14
-
15
- would be parsed by Sexpistol like so:
16
-
17
- [:define, :test, [:lambda, [], [
18
- [:print, "Hello world!\n"],
19
- [:print, 1],
20
- [:print, 9.01],
21
- [:print, 2.0e10],
22
- [:print, [:+, 10, 12, 13]]
23
- ]]]
24
-
25
- === Type mappings
26
-
27
- Sexpistol supports all of the standard datatypes and converts them directly to their Ruby equivalents:
28
-
29
- * Lists (a b c)
30
- * Integers (1 2 3)
31
- * Floats (1.0 2.0 42.9 3e6 1.2e2)
32
- * Strings ("\t\"Hello world!\"\n")
33
- * Symbols (symbol Symbol ____symbol____ symbo_l symbol? symbol! + - / ++ a+ e$, etc...)
34
-
35
- Sexpistol also supports mapping the Ruby keyword literals (nil, true, false) to their native Ruby types, although this is disabled by default for compatibility. To enable it use `@parser.ruby_keyword_literals = true`, eg:
36
-
37
- @parser = Sexpistol.new
38
- @parser.parse_string("nil false true")
39
- #=> [:nil, :false, :true]
40
-
41
- @parser.ruby_keyword_literals = true
42
- @parser.parse_string("nil false true")
43
- #=> [nil, false, true]
44
-
45
- === Installation
46
-
47
- For convenience Sexpistol is packaged as a RubyGem, to install it simply enter the following at your command line:
48
-
49
- gem install sexpistol
50
-
51
- === Usage
52
-
53
- # Create a new parser instance
54
- @parser = Sexpistol.new
55
-
56
- # Parse a string
57
- ast = @parser.parse_string("(string (to (parse)))")
58
- #=> [:string, [:to, [:parse]]]
59
-
60
- # Change the representation
61
- ast[1][0] = :is
62
- ast[1][1][0] = :parsed
63
- #=> [:string, [:is, [:parsed]]]
64
-
65
- # Turn the array structure back into an S-Expression
66
- @parser.to_sexp( ast )
67
- #=> "( string ( is ( parsed ) ) )"
68
-
69
- === Author & Credits
70
-
71
- Author:: {Aaron Gough}[mailto:aaron@aarongough.com]
72
-
73
- Copyright (c) 2010 {Aaron Gough}[http://thingsaaronmade.com/] ({thingsaaronmade.com}[http://thingsaaronmade.com/]), released under the MIT license
data/Rakefile DELETED
@@ -1,42 +0,0 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
4
-
5
- desc 'Default: run unit tests.'
6
- task :default => :test
7
-
8
- begin
9
- require 'jeweler'
10
- Jeweler::Tasks.new do |gemspec|
11
- gemspec.name = "sexpistol"
12
- gemspec.summary = "An S-Expression Parser Library for Ruby"
13
- gemspec.description = "Sexpistol is an easy-to-use S-Expression parser for Ruby. It is fast and has no dependencies."
14
- gemspec.email = "aaron@aarongough.com"
15
- gemspec.homepage = "http://github.com/aarongough/sexpistol"
16
- gemspec.authors = ["Aaron Gough"]
17
- gemspec.rdoc_options << '--line-numbers' << '--inline-source'
18
- gemspec.extra_rdoc_files = ['README.rdoc', 'MIT-LICENSE']
19
- end
20
- rescue LoadError
21
- puts "Jeweler not available. Install it with: gem install jeweler"
22
- end
23
-
24
-
25
- desc 'Test sexpistol.'
26
- Rake::TestTask.new(:test) do |t|
27
- t.libs << 'lib/*.rb'
28
- t.libs << 'test'
29
- t.pattern = 'test/**/*_test.rb'
30
- t.verbose = true
31
- end
32
-
33
-
34
- desc 'Generate documentation for sexpistol.'
35
- Rake::RDocTask.new(:rdoc) do |rdoc|
36
- rdoc.rdoc_dir = 'rdoc'
37
- rdoc.title = 'Koi'
38
- rdoc.options << '--line-numbers' << '--inline-source'
39
- rdoc.rdoc_files.include('README.rdoc')
40
- rdoc.rdoc_files.include('lib/**/*.rb')
41
- rdoc.rdoc_files.include('app/**/*.rb')
42
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.4
@@ -1,138 +0,0 @@
1
- # This class contains our logic for parsing
2
- # S-Expressions. They are turned into a
3
- # native Ruby representation like:
4
- # [:def, :something [:lambda, [:a], [:do_something]]]
5
- class Sexpistol
6
-
7
- attr_accessor :ruby_keyword_literals
8
-
9
- def initialize
10
- @ruby_keyword_literals = false
11
-
12
- # Setup all of our token patterns as instance variables
13
- # so they don't have to be re-instantiated for each
14
- # run & match
15
- @string_literal_pattern = /"([^"\\]|\\.)*"/
16
- @integer_literal_pattern = /[\-\+]?[0-9]+/
17
- @float_literal_pattern = /[\-\+]?[0-9]+\.[0-9]+(e[0-9]+)?/
18
- @symbol_pattern = /[^\"\'\,\(\)]+/
19
-
20
- @string_replacement_token = "__++STRING_LITERAL++__"
21
- end
22
-
23
- # Parse a string containing an S-Expression into a
24
- # nested set of Ruby arrays
25
- def parse_string( string )
26
- string_array = split_outside_strings(string)
27
- tokens = process_tokens( string_array )
28
- structure( tokens )[1]
29
- end
30
-
31
- # Iterate over an array of strings and turn each
32
- # item into it's relevant token. ie: "string" -> :string, "1" -> 1
33
- def process_tokens( token_array )
34
- tokens = []
35
- token_array.each do |t|
36
- if(@ruby_keyword_literals)
37
- tokens << nil and next if(t == "nil")
38
- tokens << true and next if(t == "true")
39
- tokens << false and next if(t == "false")
40
- end
41
- tokens << "'" and next if(t == "'")
42
- tokens << t and next if(t == "(" || t == ")")
43
- tokens << t.to_f and next if( is_float?(t))
44
- tokens << t.to_i and next if( is_integer?(t))
45
- tokens << t.to_sym and next if( is_symbol?(t))
46
- tokens << eval(t) and next if( is_string_literal?(t))
47
- raise "\nUnrecognized token: #{t}\n"
48
- end
49
- return tokens
50
- end
51
-
52
- # Iterate over a flat array of tokens and turn it
53
- # a nested set of arrays by detecting '(' and ')'
54
- def structure( token_array, offset = 0, internal = false )
55
- program = []
56
- while(offset < token_array.length)
57
- if( token_array[offset] == "(" )
58
- offset, array = structure( token_array, offset + 1, true )
59
- program << array
60
- elsif( token_array[offset] == "'" )
61
- offset, array = structure( token_array, offset + 1, true )
62
- program << array.unshift( :quote )
63
- elsif( token_array[offset] == ")" )
64
- break
65
- else
66
- program << token_array[offset]
67
- end
68
- offset += 1
69
- end
70
- return [offset, program]
71
- end
72
-
73
- # Split up a string into an array where delimited by whitespace,
74
- # except inside string literals
75
- def split_outside_strings( string )
76
- # Find and extract all the string literals
77
- string_literals = []
78
- string = string.gsub(@string_literal_pattern) do |x|
79
- string_literals << x
80
- @string_replacement_token
81
- end
82
- # Make sure the s-expression is valid
83
- unless( string.count("(") == string.count(")") )
84
- raise Exception, "Invalid S-Expression. The number of opening and closing parentheses does not match."
85
- end
86
- # Split the string up on whitespace and parentheses
87
- array = string.gsub("(", " ( ").gsub(")", " ) ").split(" ")
88
- # replace the special string token with the original string literals
89
- array.collect! do |x|
90
- if( x == @string_replacement_token)
91
- string_literals.shift
92
- else
93
- x
94
- end
95
- end
96
- return array
97
- end
98
-
99
- # Test to see whether or not a string represents an integer
100
- def is_integer?( string )
101
- is_match?( string, @integer_literal_pattern )
102
- end
103
-
104
- # Test to see whether or not a string represents a float
105
- def is_float?( string )
106
- is_match?( string, @float_literal_pattern )
107
- end
108
-
109
- # Test to see whether or not a string represents a symbol
110
- def is_symbol?( string )
111
- is_match?( string, @symbol_pattern )
112
- end
113
-
114
- # Test to see whether or not a string represents a string literal
115
- def is_string_literal?( string )
116
- is_match?( string, @string_literal_pattern )
117
- end
118
-
119
- # Convert a set of nested arrays back into an S-Expression
120
- def to_sexp( data )
121
- mapped = data.map do |item|
122
- if( item.is_a?(Array))
123
- to_sexp(item)
124
- else
125
- item.to_s
126
- end
127
- end
128
- "( " + mapped.join(" ") + " )"
129
- end
130
-
131
- private
132
-
133
- def is_match?( string, pattern )
134
- match = string.match(pattern)
135
- return false unless match
136
- match[0].length == string.length
137
- end
138
- end
@@ -1,34 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))
2
-
3
- class BenchmarkTest < Test::Unit::TestCase
4
-
5
- require 'benchmark'
6
-
7
- test "benchmark sexpistol" do
8
- puts "\nRunning performance test...\n"
9
- parser = Sexpistol.new
10
- parser.ruby_keyword_literals = true
11
- Benchmark.bmbm do |b|
12
- b.report do
13
- 5000.times do
14
- parser.parse_string <<-EOD
15
-
16
- (display "This is a test string!")
17
-
18
- (define test (lambda () (begin
19
- (display (== 1 1))
20
- (display (== true true))
21
- (display (== false false))
22
- (display (== nil nil))
23
- (display (== 2.09 1.08))
24
- (display (== 2e6 2e12))
25
- )))
26
-
27
- EOD
28
- end
29
- end
30
- end
31
- puts
32
- end
33
-
34
- end
@@ -1,21 +0,0 @@
1
- module Test::Unit
2
- # Used to fix a minor minitest/unit incompatibility in flexmock
3
- AssertionFailedError = Class.new(StandardError)
4
-
5
- class TestCase
6
-
7
- def self.test(name, &block)
8
- test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
9
- defined = instance_method(test_name) rescue false
10
- raise "#{test_name} is already defined in #{self}" if defined
11
- if block_given?
12
- define_method(test_name, &block)
13
- else
14
- define_method(test_name) do
15
- flunk "No implementation provided for #{name}"
16
- end
17
- end
18
- end
19
-
20
- end
21
- end
data/test/test_helper.rb DELETED
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
-
4
- require_files = []
5
- require_files << File.join(File.dirname(__FILE__), '..', 'lib', 'sexpistol.rb')
6
- require_files.concat Dir[File.join(File.dirname(__FILE__), 'setup', '*.rb')]
7
-
8
- require_files.each do |file|
9
- require File.expand_path(file)
10
- end
@@ -1,35 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))
2
-
3
- class FloatLiteralTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @parser = Sexpistol.new
7
- end
8
-
9
- test "should parse sexp containing an implicitly positive float literal" do
10
- ast = @parser.parse_string("10.00")
11
- assert_equal [10.00], ast
12
- end
13
-
14
- test "should parse sexp containing an explicitly positive float literal" do
15
- ast = @parser.parse_string("+910.00")
16
- assert_equal [910.00], ast
17
- end
18
-
19
- test "should parse sexp containing an explicitly negative float literal" do
20
- ast = @parser.parse_string("-10.00")
21
- assert_equal [-10.00], ast
22
- end
23
-
24
- test "should parse sexp containing a large float literal" do
25
- ast = @parser.parse_string("1.0000127829")
26
- assert_equal [1.0000127829], ast
27
- end
28
-
29
- test "should parse sexp containing a float defined in scientific notation" do
30
- ast = @parser.parse_string("1.0e6")
31
- assert_equal [1.0e6], ast
32
- end
33
-
34
-
35
- end
@@ -1,24 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))
2
-
3
- class IntegerLiteralTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @parser = Sexpistol.new
7
- end
8
-
9
- test "should parse sexp containing an implicitly positive integer literal" do
10
- ast = @parser.parse_string("10")
11
- assert_equal [10], ast
12
- end
13
-
14
- test "should parse sexp containing an explicitly positive integer literal" do
15
- ast = @parser.parse_string("+910")
16
- assert_equal [910], ast
17
- end
18
-
19
- test "should parse sexp containing an explicitly negative integer literal" do
20
- ast = @parser.parse_string("-10")
21
- assert_equal [-10], ast
22
- end
23
-
24
- end
@@ -1,45 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))
2
-
3
- class RubyKeywordLiteralsTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @parser = Sexpistol.new
7
- end
8
-
9
- test "should parse nil as literal" do
10
- @parser.ruby_keyword_literals = true
11
- ast = @parser.parse_string('nil')
12
- assert_equal [nil], ast
13
- end
14
-
15
- test "should not parse nil as literal" do
16
- @parser.ruby_keyword_literals = false
17
- ast = @parser.parse_string('nil')
18
- assert_equal [:nil], ast
19
- end
20
-
21
- test "should parse true as literal" do
22
- @parser.ruby_keyword_literals = true
23
- ast = @parser.parse_string('true')
24
- assert_equal [true], ast
25
- end
26
-
27
- test "should not parse true as literal" do
28
- @parser.ruby_keyword_literals = false
29
- ast = @parser.parse_string('true')
30
- assert_equal [:true], ast
31
- end
32
-
33
- test "should parse false as literal" do
34
- @parser.ruby_keyword_literals = true
35
- ast = @parser.parse_string('false')
36
- assert_equal [false], ast
37
- end
38
-
39
- test "should notparse false as literal" do
40
- @parser.ruby_keyword_literals = false
41
- ast = @parser.parse_string('false')
42
- assert_equal [:false], ast
43
- end
44
-
45
- end
@@ -1,29 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))
2
-
3
- class SchemeCompatabilityTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @parser = Sexpistol.new
7
- end
8
-
9
- test "should parse #t as true" do
10
- ast = @parser.parse_string('#t')
11
- assert_equal [:"#t"], ast
12
- end
13
-
14
- test "should parse #f as false" do
15
- ast = @parser.parse_string('#f')
16
- assert_equal [:"#f"], ast
17
- end
18
-
19
- test "should allow comma quoting" do
20
- ast = @parser.parse_string("(this is '( a test))")
21
- assert_equal [[:this, :is, [:quote, [:a, :test]]]], ast
22
- end
23
-
24
- test "should allow complicated comma quoting" do
25
- ast = @parser.parse_string("(this is '( a test (also)))")
26
- assert_equal [[:this, :is, [:quote, [:a, :test, [:also]]]]], ast
27
- end
28
-
29
- end
@@ -1,39 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))
2
-
3
- class StringLiteralTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @parser = Sexpistol.new
7
- end
8
-
9
- test "should parse empty string literal" do
10
- ast = @parser.parse_string('""')
11
- assert_equal [""], ast
12
- end
13
-
14
- test "should parse string literal" do
15
- ast = @parser.parse_string('"test"')
16
- assert_equal ["test"], ast
17
- end
18
-
19
- test "should parse string literal containing escaped quotes" do
20
- ast = @parser.parse_string('"te\"st"')
21
- assert_equal ["te\"st"], ast
22
- end
23
-
24
- test "should parse string literal containing escaped characters" do
25
- ast = @parser.parse_string('"\n\t\r"')
26
- assert_equal ["\n\t\r"], ast
27
- end
28
-
29
- test "should parse string literal containing spaces" do
30
- ast = @parser.parse_string('"blah foo"')
31
- assert_equal ["blah foo"], ast
32
- end
33
-
34
- test "should parse string literal containing newlines" do
35
- ast = @parser.parse_string('"blah' + "\n" + 'foo"')
36
- assert_equal ["blah\nfoo"], ast
37
- end
38
-
39
- end
@@ -1,30 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))
2
-
3
- class StructureTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @parser = Sexpistol.new
7
- end
8
-
9
- test "should create nested set of arrays from s-expression" do
10
- ast = @parser.parse_string('(this (is (an (s_expression) (also) blah) foo) (test))')
11
- assert_equal [[:this, [:is, [:an, [:s_expression], [:also], :blah], :foo], [:test]]], ast
12
- end
13
-
14
- test "should create nested set of arrays from s-expression with string literals" do
15
- ast = @parser.parse_string('(this (is (an ("s_expression"))))')
16
- assert_equal [[:this, [:is, [:an, ["s_expression"]]]]], ast
17
- end
18
-
19
- test "should raise error on broken s-expression" do
20
- assert_raises Exception do
21
- ast = @parser.parse_string('(this (is (an (s_expression) too)')
22
- end
23
- end
24
-
25
- test "should parser () as empty list" do
26
- ast = @parser.parse_string('()')
27
- assert_equal [[]], ast
28
- end
29
-
30
- end
@@ -1,74 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))
2
-
3
- class SymbolTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @parser = Sexpistol.new
7
- end
8
-
9
- test "should parse simple symbol" do
10
- ast = @parser.parse_string("test")
11
- assert_equal [:test], ast
12
- end
13
-
14
- test "should parse symbol with trailing exclamation mark" do
15
- ast = @parser.parse_string("test!")
16
- assert_equal [:test!], ast
17
- end
18
-
19
- test "should parse symbol with trailing question mark" do
20
- ast = @parser.parse_string("test?")
21
- assert_equal [:test?], ast
22
- end
23
-
24
- test "should parse symbol containing underscores" do
25
- ast = @parser.parse_string("te__st")
26
- assert_equal [:te__st], ast
27
- end
28
-
29
- test "should parse symbol with leading underscores" do
30
- ast = @parser.parse_string("__test")
31
- assert_equal [:__test], ast
32
- end
33
-
34
- test "should parse symbol with trailing underscores" do
35
- ast = @parser.parse_string("test__")
36
- assert_equal [:test__], ast
37
- end
38
-
39
- test "should parse CamelCase symbol" do
40
- ast = @parser.parse_string("TestSymbol")
41
- assert_equal [:TestSymbol], ast
42
- end
43
-
44
- test "should parse complex symbol" do
45
- ast = @parser.parse_string("__TestSymbol_TEST__?")
46
- assert_equal [:__TestSymbol_TEST__?], ast
47
- end
48
-
49
- test "should parse symbol containing addition operators" do
50
- ast = @parser.parse_string("+")
51
- assert_equal [:+], ast
52
- end
53
-
54
- test "should parse symbol containing multiplication operators" do
55
- ast = @parser.parse_string("*")
56
- assert_equal [:*], ast
57
- end
58
-
59
- test "should parse symbol containing subtraction operators" do
60
- ast = @parser.parse_string("-")
61
- assert_equal [:-], ast
62
- end
63
-
64
- test "should parse symbol containing division operators" do
65
- ast = @parser.parse_string("/")
66
- assert_equal [:"/"], ast
67
- end
68
-
69
- test "should parse symbol containing any character except single and double quotes, backquote, parentheses and comma" do
70
- ast = @parser.parse_string("~1!2@3#4$%5^6&7*890-_+=|\]}[{poiuytrewqasdfghjklmnbvcxzZXCVBNMLKJHGFDSAQWERTYUIOP:;/?><")
71
- assert_equal [:"~1!2@3#4$%5^6&7*890-_+=|\]}[{poiuytrewqasdfghjklmnbvcxzZXCVBNMLKJHGFDSAQWERTYUIOP:;/?><"], ast
72
- end
73
-
74
- end
@@ -1,15 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))
2
-
3
- class ToSexpTest < Test::Unit::TestCase
4
-
5
- def setup
6
- @parser = Sexpistol.new
7
- end
8
-
9
- test "should convert nested arrays back into an S-Expression" do
10
- ast = [:string, [:is, [:parsed]]]
11
- sexp = @parser.to_sexp(ast)
12
- assert_equal "( string ( is ( parsed ) ) )", sexp
13
- end
14
-
15
- end