rison-rb 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a83b5d441ae091c5bad130f48f7a55de58460dca2c8bbd2eaabae1b56dadaefe
4
+ data.tar.gz: 9a7a39909bd95c2effa43b783b0c1f669c94a198014e8110ca4444715ed4128c
5
+ SHA512:
6
+ metadata.gz: a9330ef0b5968843544fcc542f6f343ef46ed7edb61dca3a9a52a16cfc468f15b421617c309d04377e5b8fde24d95a521cc778b4a281f5be8723bf0e4b197e8f
7
+ data.tar.gz: 95c6bfb20299ffb1f610cecf275fbd47c525cd51844079e2ba0778ae4101b6ecaa1ea70618181cd0a776f7e3fc4445e340aaada04e47d50a21cdf457dd2322b7
@@ -0,0 +1,30 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ branches:
9
+ - master
10
+ schedule:
11
+ - cron: "0 0 * * *"
12
+
13
+ jobs:
14
+ spec:
15
+ name: Ruby ${{ matrix.ruby_version }}
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ matrix:
19
+ ruby_version: ['2.4.x', '2.5.x', '2.6.x']
20
+ steps:
21
+ - uses: actions/checkout@v1
22
+ - name: Set up Ruby ${{ matrix.ruby_version }}
23
+ uses: actions/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby_version }}
26
+ - name: Run spec
27
+ run: |
28
+ gem install bundler
29
+ bundle install --jobs 4 --retry 3
30
+ bundle exec rake
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
14
+ /lib/rison/parser.output
15
+ /lib/rison/object/parser.output
16
+ /lib/rison/array/parser.output
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,3 @@
1
+ ## v0.1.0 (2019-10-27)
2
+
3
+ Initial release
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at watassbass@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in rison.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Kazuma Watanabe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,82 @@
1
+ # rison-rb
2
+ [![Build Status](https://github.com/wata727/rison-rb/workflows/build/badge.svg?branch=master)](https://github.com/wata727/rison-rb/actions)
3
+ [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE.txt)
4
+ [![Gem Version](https://badge.fury.io/rb/rison-rb.svg)](https://badge.fury.io/rb/rison-rb)
5
+
6
+ A Ruby implementation for [Rison - Compact Data in URIs](https://rison.io).
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'rison-rb'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install rison-rb
23
+
24
+ ## Usage
25
+
26
+ This is a Ruby implementation for Rison that represents compact data in URIs. This module provides a parsing and dumping API like JSON module:
27
+
28
+ ```ruby
29
+ require "rison"
30
+
31
+ Rison.dump({ a: 1, b: true , c: ['foo', 'bar'] }) # => (a:1,b:!t,c:!(foo,bar))
32
+ Rison.parse('(a:1,b:!t,c:!(foo,bar))') # => { 'a' => 1, 'b' => true , 'c' => ['foo', 'bar'] }
33
+ ```
34
+
35
+ ### Symbolize names
36
+
37
+ Parsing generates a hash key as a string, just like JSON module. But you can also switch keys to symbols with the `symbolize_names` option:
38
+
39
+ ```ruby
40
+ Rison.parse('(a:!(foo,bar,(b:1)))', symbolize_names: true) # => { a: ['foo', 'bar', { b: 1 }] }
41
+ ```
42
+
43
+ ### O-Rison and A-Rison
44
+
45
+ Similarly, O-Rison and A-Rison variations are supported:
46
+
47
+ ```ruby
48
+ # O-Rison
49
+ Rison.dump({ a: 1, b: 2 }, mode: :object) # => a:1,b:2
50
+ Rison.parse('a:1,b:2', mode: :object) # => { 'a' => 1, 'b' => 2 }
51
+
52
+ # A-Rison
53
+ Rison.dump(['foo', 'bar'], mode: :array) # => foo,bar
54
+ Rison.parse('foo,bar', mode: :array) # => ['foo', 'bar']
55
+ ```
56
+
57
+ ### Differences from the original syntax
58
+
59
+ [The original syntax](https://rison.io) defines only alphanumeric and `-_./~` as ASCII characters for idchar. But [rison.js](https://github.com/Nanonid/rison) accepts other ASCII characters as idchar.
60
+
61
+ rison-rb conforms to the rison.js implementation. Therefore, it differs from the original syntax in the following points:
62
+
63
+ - It accepts ASCII characters other than `<space>'!:(),*@$` and all non-ASCII characters as idchar.
64
+ - Numbers starting with 0 are allowed.
65
+
66
+ ## Development
67
+
68
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
69
+
70
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
71
+
72
+ ## Contributing
73
+
74
+ Bug reports and pull requests are welcome on GitHub at https://github.com/wata727/rison-rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
75
+
76
+ ## License
77
+
78
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
79
+
80
+ ## Code of Conduct
81
+
82
+ Everyone interacting in the rison-rb project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/wata727/rison-rb/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,16 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
8
+ rule /\.rb/ => ".y" do |t|
9
+ sh "racc", "-v", "-o", "#{t.name}", "#{t.source}"
10
+ end
11
+
12
+ task :racc => %w(
13
+ lib/rison/parser.rb
14
+ lib/rison/object/parser.rb
15
+ lib/rison/array/parser.rb
16
+ )
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rison"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,66 @@
1
+ require "strscan"
2
+
3
+ require "rison/version"
4
+ require "rison/dumper"
5
+ require "rison/parser"
6
+ require "rison/object/dumper"
7
+ require "rison/object/parser"
8
+ require "rison/array/dumper"
9
+ require "rison/array/parser"
10
+
11
+ module Rison
12
+ class DumperError < StandardError; end
13
+ class ParserError < StandardError; end
14
+ class InvalidMode < StandardError; end
15
+
16
+ class << self
17
+ def dump(object, options = {})
18
+ mode = options[:mode] || :default
19
+
20
+ case mode.to_sym
21
+ when :default
22
+ ::Rison::Dumper.dump(object)
23
+ when :object
24
+ ::Rison::Object::Dumper.dump_object(object)
25
+ when :array
26
+ ::Rison::Array::Dumper.dump_array(object)
27
+ else
28
+ raise InvalidMode.new("Invalid mode: #{mode}")
29
+ end
30
+ end
31
+
32
+ def parse(source, options = {})
33
+ mode = options[:mode] || :default
34
+
35
+ parser_class = case mode.to_sym
36
+ when :default
37
+ ::Rison::Parser
38
+ when :object
39
+ ::Rison::Object::Parser
40
+ when :array
41
+ ::Rison::Array::Parser
42
+ else
43
+ raise InvalidMode.new("Invalid mode: #{mode}")
44
+ end
45
+
46
+ object = parser_class.parse(source)
47
+ return object unless options[:symbolize_names]
48
+ deep_symbolize_names(object)
49
+ end
50
+
51
+ private
52
+
53
+ def deep_symbolize_names(object)
54
+ case object
55
+ when Hash
56
+ object.each_with_object({}) do |(k, v), ret|
57
+ ret[k.to_sym] = deep_symbolize_names(v)
58
+ end
59
+ when ::Array
60
+ object.map { |e| deep_symbolize_names(e) }
61
+ else
62
+ object
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,18 @@
1
+ module Rison
2
+ module Array
3
+ class Dumper < ::Rison::Dumper
4
+ class << self
5
+ def dump_array(object)
6
+ case object
7
+ when []
8
+ %('')
9
+ when ::Array
10
+ object.map { |e| dump(e) }.join(',')
11
+ else
12
+ raise DumperError.new("A-Rison only accepts Array as the top level, but #{object.inspect} received.")
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,610 @@
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by Racc 1.4.15
4
+ # from Racc grammer file "".
5
+ #
6
+
7
+ require 'racc/parser.rb'
8
+ module Rison
9
+ module Array
10
+ class Parser < Racc::Parser
11
+
12
+ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 76)
13
+
14
+ attr_reader :source, :input
15
+
16
+ def initialize(source)
17
+ @source = source
18
+ @input = StringScanner.new(source)
19
+ end
20
+
21
+ def self.parse(source)
22
+ self.new(source).do_parse
23
+ rescue Racc::ParseError => exn
24
+ raise ParserError.new("#{exn.message} in #{source}")
25
+ end
26
+
27
+ def next_token
28
+ case
29
+ when input.eos?
30
+ [false, false]
31
+ when input.scan(/'/)
32
+ [:QUOTE, input.matched]
33
+ when input.scan(/\(/)
34
+ [:LPAREN, input.matched]
35
+ when input.scan(/\)/)
36
+ [:RPAREN, input.matched]
37
+ when input.scan(/:/)
38
+ [:COLON, input.matched]
39
+ when input.scan(/\./)
40
+ [:DOT, input.matched]
41
+ when input.scan(/\,/)
42
+ [:COMMA, input.matched]
43
+ when input.scan(/!/)
44
+ [:EXCLAM, input.matched]
45
+ when input.scan(/\-/)
46
+ [:MINUS, input.matched]
47
+ when input.scan(/e/)
48
+ [:E, input.matched]
49
+ when input.scan(/t/)
50
+ [:T, input.matched]
51
+ when input.scan(/f/)
52
+ [:F, input.matched]
53
+ when input.scan(/n/)
54
+ [:N, input.matched]
55
+ # Originally, 0 is not allowed at the beginning of the number, but rison.js accepts this.
56
+ when input.scan(/[0-9]/)
57
+ [:DIGIT, input.matched]
58
+ # IDSTART and IDCHAR should originally accept only the ASCII symbols `-_./~`, but rison.js accepts other symbols.
59
+ # @see https://rison.io/
60
+ # @see https://github.com/Nanonid/rison/blob/e64af6c096fd30950ec32cfd48526ca6ee21649d/js/rison.js#L77-L84
61
+ when input.scan(/[^\-0-9 '!:\(\),\*@\$]/)
62
+ [:IDSTART, input.matched]
63
+ when input.scan(/[^ '!:\(\),\*@\$]/)
64
+ [:IDCHAR, input.matched]
65
+ when input.scan(/[^\'\!]/)
66
+ [:STRCHAR, input.matched]
67
+ end
68
+ end
69
+ ...end parser.y/module_eval...
70
+ ##### State transition tables begin ###
71
+
72
+ racc_action_table = [
73
+ 69, 36, 37, 38, 35, 34, 17, 18, 19, 26,
74
+ 28, 29, 15, 16, 20, 32, 25, 36, 37, 38,
75
+ 35, 34, 17, 18, 19, 26, 28, 29, 15, 16,
76
+ 20, 32, 45, 4, 57, 55, 65, 5, 17, 18,
77
+ 19, 64, 23, 22, 15, 16, 20, 2, 4, 77,
78
+ 59, 59, 5, 17, 18, 19, 82, 23, 22, 15,
79
+ 16, 20, 45, 4, 70, 24, 50, 5, 17, 18,
80
+ 19, 59, 23, 22, 15, 16, 20, 36, 37, 38,
81
+ 35, 34, 17, 18, 19, 26, 28, 29, 15, 16,
82
+ 20, 32, 45, 60, 39, 45, 61, -38, 17, 18,
83
+ 19, 17, 18, 19, 15, 16, 20, 15, 16, 20,
84
+ 45, 4, 62, 66, 67, 5, 17, 18, 19, 68,
85
+ 23, 22, 15, 16, 20, 17, 18, 19, 26, 28,
86
+ 29, 15, 16, 20, 17, 18, 19, 26, 28, 29,
87
+ 15, 16, 20, 46, 57, 59, 59, nil, 47, 48,
88
+ 49 ]
89
+
90
+ racc_action_check = [
91
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
92
+ 45, 45, 45, 45, 45, 45, 2, 2, 2, 2,
93
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
94
+ 2, 2, 50, 50, 21, 21, 34, 50, 50, 50,
95
+ 50, 34, 50, 50, 50, 50, 50, 0, 0, 57,
96
+ 59, 60, 0, 0, 0, 0, 71, 0, 0, 0,
97
+ 0, 0, 46, 46, 46, 1, 6, 46, 46, 46,
98
+ 46, 22, 46, 46, 46, 46, 46, 31, 31, 31,
99
+ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
100
+ 31, 31, 4, 23, 4, 67, 24, 25, 4, 4,
101
+ 4, 67, 67, 67, 4, 4, 4, 67, 67, 67,
102
+ 68, 68, 30, 40, 41, 68, 68, 68, 68, 42,
103
+ 68, 68, 68, 68, 68, 52, 52, 52, 52, 52,
104
+ 52, 52, 52, 52, 14, 14, 14, 14, 14, 14,
105
+ 14, 14, 14, 5, 53, 55, 56, nil, 5, 5,
106
+ 5 ]
107
+
108
+ racc_action_pointer = [
109
+ 45, 65, 14, nil, 90, 140, 61, nil, nil, nil,
110
+ nil, nil, nil, nil, 126, nil, nil, nil, nil, nil,
111
+ nil, 19, 58, 80, 96, 92, nil, nil, nil, nil,
112
+ 110, 74, nil, nil, 34, nil, nil, nil, nil, nil,
113
+ 109, 109, 113, nil, nil, -2, 60, nil, nil, nil,
114
+ 30, nil, 117, 129, nil, 132, 133, 37, nil, 37,
115
+ 38, nil, nil, nil, nil, nil, nil, 93, 108, nil,
116
+ nil, 52, nil, nil, nil, nil, nil, nil, nil, nil,
117
+ nil, nil, nil ]
118
+
119
+ racc_action_default = [
120
+ -64, -64, -64, -2, -64, -64, -10, -14, -15, -16,
121
+ -17, -18, -19, -20, -24, -32, -33, -34, -35, -36,
122
+ -37, -50, -54, -64, -64, -1, -28, -29, -30, -31,
123
+ -64, -40, -42, -43, -64, -46, -47, -48, -49, -3,
124
+ -64, -5, -64, -12, -13, -64, -64, -21, -22, -23,
125
+ -64, -25, -26, -51, -52, -64, -64, -62, -55, -60,
126
+ -56, 83, -39, -41, -44, -45, -4, -64, -64, -38,
127
+ -8, -64, -11, -27, -53, -58, -59, -63, -61, -57,
128
+ -6, -7, -9 ]
129
+
130
+ racc_goto_table = [
131
+ 44, 40, 43, 3, 27, 58, 51, 52, 54, 1,
132
+ 63, 53, 81, nil, nil, nil, 27, nil, nil, nil,
133
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
134
+ nil, nil, nil, 27, nil, nil, nil, nil, 75, 76,
135
+ 74, nil, 78, 79, 73, 52, nil, 27, nil, 71,
136
+ nil, nil, nil, 72, 27, nil, nil, nil, nil, nil,
137
+ nil, nil, nil, 44, 80, 43 ]
138
+
139
+ racc_goto_check = [
140
+ 10, 4, 9, 2, 14, 22, 15, 16, 21, 1,
141
+ 17, 20, 7, nil, nil, nil, 14, nil, nil, nil,
142
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
143
+ nil, nil, nil, 14, nil, nil, nil, nil, 22, 22,
144
+ 21, nil, 22, 22, 15, 16, nil, 14, nil, 2,
145
+ nil, nil, nil, 2, 14, nil, nil, nil, nil, nil,
146
+ nil, nil, nil, 10, 4, 9 ]
147
+
148
+ racc_goto_pointer = [
149
+ nil, 9, 3, nil, -3, nil, nil, -56, nil, -2,
150
+ -4, nil, nil, nil, 2, -8, -7, -21, nil, nil,
151
+ -10, -13, -17, nil ]
152
+
153
+ racc_goto_default = [
154
+ nil, nil, nil, 10, nil, 41, 42, 6, 11, 7,
155
+ 8, 9, 12, 13, 14, nil, 33, 30, 31, 21,
156
+ nil, nil, nil, 56 ]
157
+
158
+ racc_reduce_table = [
159
+ 0, 0, :racc_error,
160
+ 2, 19, :_reduce_1,
161
+ 1, 19, :_reduce_none,
162
+ 2, 21, :_reduce_3,
163
+ 3, 21, :_reduce_4,
164
+ 1, 22, :_reduce_none,
165
+ 3, 22, :_reduce_6,
166
+ 3, 23, :_reduce_7,
167
+ 3, 26, :_reduce_8,
168
+ 4, 26, :_reduce_9,
169
+ 1, 20, :_reduce_10,
170
+ 3, 20, :_reduce_11,
171
+ 1, 24, :_reduce_none,
172
+ 1, 24, :_reduce_none,
173
+ 1, 25, :_reduce_none,
174
+ 1, 25, :_reduce_none,
175
+ 1, 25, :_reduce_none,
176
+ 1, 25, :_reduce_none,
177
+ 1, 25, :_reduce_none,
178
+ 1, 25, :_reduce_none,
179
+ 1, 25, :_reduce_none,
180
+ 2, 30, :_reduce_21,
181
+ 2, 30, :_reduce_22,
182
+ 2, 31, :_reduce_23,
183
+ 1, 27, :_reduce_none,
184
+ 2, 27, :_reduce_25,
185
+ 1, 33, :_reduce_none,
186
+ 2, 33, :_reduce_27,
187
+ 1, 34, :_reduce_none,
188
+ 1, 34, :_reduce_none,
189
+ 1, 34, :_reduce_none,
190
+ 1, 34, :_reduce_none,
191
+ 1, 32, :_reduce_none,
192
+ 1, 32, :_reduce_none,
193
+ 1, 32, :_reduce_none,
194
+ 1, 32, :_reduce_none,
195
+ 1, 32, :_reduce_none,
196
+ 1, 32, :_reduce_none,
197
+ 2, 28, :_reduce_38,
198
+ 3, 28, :_reduce_39,
199
+ 1, 35, :_reduce_none,
200
+ 2, 35, :_reduce_41,
201
+ 1, 36, :_reduce_none,
202
+ 1, 36, :_reduce_none,
203
+ 2, 36, :_reduce_44,
204
+ 2, 36, :_reduce_45,
205
+ 1, 36, :_reduce_none,
206
+ 1, 36, :_reduce_none,
207
+ 1, 36, :_reduce_none,
208
+ 1, 36, :_reduce_none,
209
+ 1, 29, :_reduce_50,
210
+ 2, 29, :_reduce_51,
211
+ 2, 29, :_reduce_52,
212
+ 3, 29, :_reduce_53,
213
+ 1, 37, :_reduce_54,
214
+ 2, 37, :_reduce_55,
215
+ 2, 37, :_reduce_56,
216
+ 3, 37, :_reduce_57,
217
+ 2, 38, :_reduce_58,
218
+ 2, 39, :_reduce_59,
219
+ 1, 40, :_reduce_none,
220
+ 2, 40, :_reduce_61,
221
+ 1, 41, :_reduce_62,
222
+ 2, 41, :_reduce_63 ]
223
+
224
+ racc_reduce_n = 64
225
+
226
+ racc_shift_n = 83
227
+
228
+ racc_token_table = {
229
+ false => 0,
230
+ :error => 1,
231
+ :QUOTE => 2,
232
+ :LPAREN => 3,
233
+ :RPAREN => 4,
234
+ :COMMA => 5,
235
+ :COLON => 6,
236
+ :EXCLAM => 7,
237
+ :T => 8,
238
+ :F => 9,
239
+ :N => 10,
240
+ :IDCHAR => 11,
241
+ :MINUS => 12,
242
+ :DIGIT => 13,
243
+ :IDSTART => 14,
244
+ :E => 15,
245
+ :DOT => 16,
246
+ :STRCHAR => 17 }
247
+
248
+ racc_nt_base = 18
249
+
250
+ racc_use_result_var = true
251
+
252
+ Racc_arg = [
253
+ racc_action_table,
254
+ racc_action_check,
255
+ racc_action_default,
256
+ racc_action_pointer,
257
+ racc_goto_table,
258
+ racc_goto_check,
259
+ racc_goto_default,
260
+ racc_goto_pointer,
261
+ racc_nt_base,
262
+ racc_reduce_table,
263
+ racc_token_table,
264
+ racc_shift_n,
265
+ racc_reduce_n,
266
+ racc_use_result_var ]
267
+
268
+ Racc_token_to_s_table = [
269
+ "$end",
270
+ "error",
271
+ "QUOTE",
272
+ "LPAREN",
273
+ "RPAREN",
274
+ "COMMA",
275
+ "COLON",
276
+ "EXCLAM",
277
+ "T",
278
+ "F",
279
+ "N",
280
+ "IDCHAR",
281
+ "MINUS",
282
+ "DIGIT",
283
+ "IDSTART",
284
+ "E",
285
+ "DOT",
286
+ "STRCHAR",
287
+ "$start",
288
+ "target",
289
+ "elements",
290
+ "object",
291
+ "members",
292
+ "pair",
293
+ "key",
294
+ "value",
295
+ "array",
296
+ "id",
297
+ "string",
298
+ "number",
299
+ "bool",
300
+ "null",
301
+ "idstart",
302
+ "idchars",
303
+ "idchar",
304
+ "strchars",
305
+ "strchar",
306
+ "int",
307
+ "frac",
308
+ "exp",
309
+ "digits",
310
+ "e" ]
311
+
312
+ Racc_debug_parser = false
313
+
314
+ ##### State transition tables end #####
315
+
316
+ # reduce 0 omitted
317
+
318
+ module_eval(<<'.,.,', 'parser.y', 3)
319
+ def _reduce_1(val, _values, result)
320
+ result = []
321
+ result
322
+ end
323
+ .,.,
324
+
325
+ # reduce 2 omitted
326
+
327
+ module_eval(<<'.,.,', 'parser.y', 6)
328
+ def _reduce_3(val, _values, result)
329
+ result = {}
330
+ result
331
+ end
332
+ .,.,
333
+
334
+ module_eval(<<'.,.,', 'parser.y', 7)
335
+ def _reduce_4(val, _values, result)
336
+ result = val[1]
337
+ result
338
+ end
339
+ .,.,
340
+
341
+ # reduce 5 omitted
342
+
343
+ module_eval(<<'.,.,', 'parser.y', 10)
344
+ def _reduce_6(val, _values, result)
345
+ result = val[0].merge(val[2])
346
+ result
347
+ end
348
+ .,.,
349
+
350
+ module_eval(<<'.,.,', 'parser.y', 12)
351
+ def _reduce_7(val, _values, result)
352
+ result = { val[0] => val[2] }
353
+ result
354
+ end
355
+ .,.,
356
+
357
+ module_eval(<<'.,.,', 'parser.y', 14)
358
+ def _reduce_8(val, _values, result)
359
+ result = []
360
+ result
361
+ end
362
+ .,.,
363
+
364
+ module_eval(<<'.,.,', 'parser.y', 15)
365
+ def _reduce_9(val, _values, result)
366
+ result = val[2]
367
+ result
368
+ end
369
+ .,.,
370
+
371
+ module_eval(<<'.,.,', 'parser.y', 17)
372
+ def _reduce_10(val, _values, result)
373
+ result = [val[0]]
374
+ result
375
+ end
376
+ .,.,
377
+
378
+ module_eval(<<'.,.,', 'parser.y', 18)
379
+ def _reduce_11(val, _values, result)
380
+ result = val[2].unshift(val[0])
381
+ result
382
+ end
383
+ .,.,
384
+
385
+ # reduce 12 omitted
386
+
387
+ # reduce 13 omitted
388
+
389
+ # reduce 14 omitted
390
+
391
+ # reduce 15 omitted
392
+
393
+ # reduce 16 omitted
394
+
395
+ # reduce 17 omitted
396
+
397
+ # reduce 18 omitted
398
+
399
+ # reduce 19 omitted
400
+
401
+ # reduce 20 omitted
402
+
403
+ module_eval(<<'.,.,', 'parser.y', 24)
404
+ def _reduce_21(val, _values, result)
405
+ result = true
406
+ result
407
+ end
408
+ .,.,
409
+
410
+ module_eval(<<'.,.,', 'parser.y', 25)
411
+ def _reduce_22(val, _values, result)
412
+ result = false
413
+ result
414
+ end
415
+ .,.,
416
+
417
+ module_eval(<<'.,.,', 'parser.y', 27)
418
+ def _reduce_23(val, _values, result)
419
+ result = nil
420
+ result
421
+ end
422
+ .,.,
423
+
424
+ # reduce 24 omitted
425
+
426
+ module_eval(<<'.,.,', 'parser.y', 30)
427
+ def _reduce_25(val, _values, result)
428
+ result = val[0] + val[1]
429
+ result
430
+ end
431
+ .,.,
432
+
433
+ # reduce 26 omitted
434
+
435
+ module_eval(<<'.,.,', 'parser.y', 33)
436
+ def _reduce_27(val, _values, result)
437
+ result = val[0] + val[1]
438
+ result
439
+ end
440
+ .,.,
441
+
442
+ # reduce 28 omitted
443
+
444
+ # reduce 29 omitted
445
+
446
+ # reduce 30 omitted
447
+
448
+ # reduce 31 omitted
449
+
450
+ # reduce 32 omitted
451
+
452
+ # reduce 33 omitted
453
+
454
+ # reduce 34 omitted
455
+
456
+ # reduce 35 omitted
457
+
458
+ # reduce 36 omitted
459
+
460
+ # reduce 37 omitted
461
+
462
+ module_eval(<<'.,.,', 'parser.y', 39)
463
+ def _reduce_38(val, _values, result)
464
+ result = ''
465
+ result
466
+ end
467
+ .,.,
468
+
469
+ module_eval(<<'.,.,', 'parser.y', 40)
470
+ def _reduce_39(val, _values, result)
471
+ result = val[1]
472
+ result
473
+ end
474
+ .,.,
475
+
476
+ # reduce 40 omitted
477
+
478
+ module_eval(<<'.,.,', 'parser.y', 43)
479
+ def _reduce_41(val, _values, result)
480
+ result = val[0] + val[1]
481
+ result
482
+ end
483
+ .,.,
484
+
485
+ # reduce 42 omitted
486
+
487
+ # reduce 43 omitted
488
+
489
+ module_eval(<<'.,.,', 'parser.y', 47)
490
+ def _reduce_44(val, _values, result)
491
+ result = '!'
492
+ result
493
+ end
494
+ .,.,
495
+
496
+ module_eval(<<'.,.,', 'parser.y', 48)
497
+ def _reduce_45(val, _values, result)
498
+ result = "'"
499
+ result
500
+ end
501
+ .,.,
502
+
503
+ # reduce 46 omitted
504
+
505
+ # reduce 47 omitted
506
+
507
+ # reduce 48 omitted
508
+
509
+ # reduce 49 omitted
510
+
511
+ module_eval(<<'.,.,', 'parser.y', 54)
512
+ def _reduce_50(val, _values, result)
513
+ result = val[0].to_i
514
+ result
515
+ end
516
+ .,.,
517
+
518
+ module_eval(<<'.,.,', 'parser.y', 55)
519
+ def _reduce_51(val, _values, result)
520
+ result = "#{val[0]}#{val[1]}".to_f
521
+ result
522
+ end
523
+ .,.,
524
+
525
+ module_eval(<<'.,.,', 'parser.y', 56)
526
+ def _reduce_52(val, _values, result)
527
+ result = "#{val[0]}#{val[1]}".to_f
528
+ result
529
+ end
530
+ .,.,
531
+
532
+ module_eval(<<'.,.,', 'parser.y', 57)
533
+ def _reduce_53(val, _values, result)
534
+ result = "#{val[0]}#{val[1]}#{val[2]}".to_f
535
+ result
536
+ end
537
+ .,.,
538
+
539
+ module_eval(<<'.,.,', 'parser.y', 59)
540
+ def _reduce_54(val, _values, result)
541
+ result = val[0].to_i
542
+ result
543
+ end
544
+ .,.,
545
+
546
+ module_eval(<<'.,.,', 'parser.y', 60)
547
+ def _reduce_55(val, _values, result)
548
+ result = "#{val[0]}#{val[1]}".to_i
549
+ result
550
+ end
551
+ .,.,
552
+
553
+ module_eval(<<'.,.,', 'parser.y', 61)
554
+ def _reduce_56(val, _values, result)
555
+ result = "-#{val[1]}".to_i
556
+ result
557
+ end
558
+ .,.,
559
+
560
+ module_eval(<<'.,.,', 'parser.y', 62)
561
+ def _reduce_57(val, _values, result)
562
+ result = "-#{val[1]}#{val[2]}".to_i
563
+ result
564
+ end
565
+ .,.,
566
+
567
+ module_eval(<<'.,.,', 'parser.y', 64)
568
+ def _reduce_58(val, _values, result)
569
+ result = "#{val[0]}#{val[1]}"
570
+ result
571
+ end
572
+ .,.,
573
+
574
+ module_eval(<<'.,.,', 'parser.y', 66)
575
+ def _reduce_59(val, _values, result)
576
+ result = "#{val[0]}#{val[1]}"
577
+ result
578
+ end
579
+ .,.,
580
+
581
+ # reduce 60 omitted
582
+
583
+ module_eval(<<'.,.,', 'parser.y', 69)
584
+ def _reduce_61(val, _values, result)
585
+ result = "#{val[0]}#{val[1]}"
586
+ result
587
+ end
588
+ .,.,
589
+
590
+ module_eval(<<'.,.,', 'parser.y', 71)
591
+ def _reduce_62(val, _values, result)
592
+ result = 'e'
593
+ result
594
+ end
595
+ .,.,
596
+
597
+ module_eval(<<'.,.,', 'parser.y', 72)
598
+ def _reduce_63(val, _values, result)
599
+ result = "e-"
600
+ result
601
+ end
602
+ .,.,
603
+
604
+ def _reduce_none(val, _values, result)
605
+ val[0]
606
+ end
607
+
608
+ end # class Parser
609
+ end # module Array
610
+ end # module Rison