edn_turbo 0.5.7 → 0.6.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.
- checksums.yaml +5 -5
- data/.rspec +1 -0
- data/CHANGELOG.md +15 -0
- data/Dockerfile +34 -0
- data/LICENSE +1 -1
- data/README.md +8 -22
- data/Rakefile +22 -19
- data/bin/build_docker_image.sh +11 -0
- data/bin/console.sh +5 -0
- data/docker-compose.yml +10 -0
- data/ext/edn_turbo/edn_parser.cc +336 -314
- data/ext/edn_turbo/edn_parser.rl +63 -41
- data/ext/edn_turbo/extconf.rb +24 -1
- data/ext/edn_turbo/main.cc +189 -166
- data/ext/edn_turbo/parser.h +104 -76
- data/ext/edn_turbo/parser_def.cc +204 -182
- data/ext/edn_turbo/util.cc +241 -219
- data/ext/edn_turbo/util.h +48 -26
- data/ext/edn_turbo/util_unicode.cc +41 -19
- data/ext/edn_turbo/util_unicode.h +29 -7
- data/lib/edn_turbo.rb +22 -0
- data/lib/edn_turbo/edn_parser.rb +22 -0
- data/lib/edn_turbo/version.rb +23 -3
- data/spec/edn_turbo/edn_parser_spec.rb +384 -0
- data/spec/spec_helper.rb +96 -0
- metadata +42 -11
- data/test/test_output_diff.rb +0 -408
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 409d493aab7167c3bac13a53580bea45735c02fc1918f57fd5b386a390d43750
|
4
|
+
data.tar.gz: 3c9b3786db7a9b2f7732735898b3b78c7dfab041b3f11511d8866b7093629cf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1b753f68eadd7e5466dd863606085dd8eeaa489c01e0ef5473ccb9e5562d70611ff35999db5263ffef42813a1404f118f26672482b36e7ca2e8fde50e96d187
|
7
|
+
data.tar.gz: d0ab9b94babb9c4d0293f270266963555e805edbaf09a28c55de59281fba52e6fb6cb0af189eecd4daa96029d254d5521d1fa916d3f91ff9e2c638b4cbc7c08b
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
|
3
|
+
|
4
|
+
## 0.6.0 - 2019-05-13
|
5
|
+
### Changed
|
6
|
+
- switched from MiniTest to RSpec.
|
7
|
+
- replaced `NULL` with `nullptr`.
|
8
|
+
- replaced old-style casts.
|
9
|
+
- prohibit Parser copy and move ops.
|
10
|
+
- assigning a source that does not respond to `read` now throws
|
11
|
+
`ArgumentError` instead of `RuntimeError`.
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- initial version of docker configs for testing on Ubuntu.
|
15
|
+
|
data/Dockerfile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
FROM buildpack-deps:stretch
|
2
|
+
MAINTAINER github@digressed.net
|
3
|
+
|
4
|
+
ENV LC_ALL C.UTF-8
|
5
|
+
|
6
|
+
# Update Ubuntu Software repository
|
7
|
+
RUN apt-get update
|
8
|
+
|
9
|
+
# install dependencies & utils
|
10
|
+
RUN apt-get install -y \
|
11
|
+
libicu-dev \
|
12
|
+
curl \
|
13
|
+
libreadline-dev
|
14
|
+
|
15
|
+
# aliases, environment
|
16
|
+
RUN echo 'alias h="history"' >> /root/.bashrc
|
17
|
+
RUN echo 'alias be="bundle exec"' >> /root/.bashrc
|
18
|
+
ENV PATH "/root/.rbenv/bin:/root/.rbenv/shims:$PATH"
|
19
|
+
|
20
|
+
# install rbenv & ruby
|
21
|
+
RUN \curl -sL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash -
|
22
|
+
RUN eval "$(rbenv init -)"
|
23
|
+
|
24
|
+
ENV RUBY_VERSION=2.6.3
|
25
|
+
RUN rbenv install ${RUBY_VERSION}
|
26
|
+
RUN rbenv global ${RUBY_VERSION}
|
27
|
+
|
28
|
+
# mute bundle warning about root user
|
29
|
+
RUN bundle config --global silence_root_warning 1
|
30
|
+
|
31
|
+
WORKDIR /gem
|
32
|
+
|
33
|
+
# cleanup
|
34
|
+
RUN rm -rf /var/lib/apt/lists/*
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,14 +1,13 @@
|
|
1
|
-
edn_turbo 0.
|
1
|
+
edn_turbo 0.6.0
|
2
2
|
===============
|
3
3
|
|
4
|
-
Fast Ragel-based EDN parser for Ruby.
|
4
|
+
Fast (Ragel)[http://www.colm.net/open-source/ragel/]-based EDN parser for Ruby.
|
5
5
|
|
6
|
-
`edn_turbo`
|
6
|
+
`edn_turbo` can be used as a parser plugin for
|
7
7
|
[edn](https://github.com/relevance/edn-ruby). With a few exceptions
|
8
8
|
`edn_turbo` provides the same functionality as the edn gem, but since
|
9
|
-
the `edn_turbo` parser is implemented in C
|
10
|
-
|
11
|
-
|
9
|
+
the `edn_turbo` parser is implemented in C++, it is an order of
|
10
|
+
magnitude faster.
|
12
11
|
|
13
12
|
Some quick sample runs comparing time output of file reads using `edn`
|
14
13
|
and `edn_turbo` (see [issue 12](https://github.com/relevance/edn-ruby/issues/12)):
|
@@ -32,27 +31,24 @@ irb(main):008:0> Benchmark.realtime { 100000.times { EDN::read(s) } }
|
|
32
31
|
=> 2.866411
|
33
32
|
```
|
34
33
|
|
35
|
-
|
36
34
|
Dependencies
|
37
35
|
============
|
38
36
|
|
37
|
+
Ruby 2.4 or greater as `edn_turbo` does not use the deprecated `Fixnum` or `Bignum`.
|
38
|
+
|
39
39
|
- ruby gems:
|
40
40
|
- [rake](http://rake.rubyforge.org)
|
41
41
|
- [rake-compiler 1.0](http://rake-compiler.rubyforge.org)
|
42
42
|
- [edn 1.1](https://github.com/relevance/edn-ruby)
|
43
|
+
- a C++-11 capable compiler.
|
43
44
|
- [icu4c](http://icu-project.org/apiref/icu4c/)
|
44
45
|
|
45
|
-
|
46
46
|
Notes:
|
47
47
|
------
|
48
48
|
|
49
49
|
- `edn_turbo` uses a ragel-based parser but the generated .cc file is
|
50
50
|
bundled so ragel should not need to be installed.
|
51
51
|
|
52
|
-
- If the gem fails to install due to a compilation error, make sure you
|
53
|
-
have `icu4c` installed. The reported gem install error doesn't make
|
54
|
-
it clear this is the issue.
|
55
|
-
|
56
52
|
Usage
|
57
53
|
=====
|
58
54
|
|
@@ -110,13 +106,3 @@ Differences with edn gem
|
|
110
106
|
`edn_turbo` reads `String` and core IO types using C-api calls.
|
111
107
|
However, data from `StringIO` sources is extracted using `read()`
|
112
108
|
calls into the ruby side.
|
113
|
-
|
114
|
-
Known problems
|
115
|
-
==============
|
116
|
-
|
117
|
-
v0.3.2:
|
118
|
-
|
119
|
-
- Some unhandled corner cases with operators and spacing
|
120
|
-
remain. `edn_turbo` handles things like `1 / 12` and `1/ 12` but
|
121
|
-
parse errors occur with `1/12` and `1 /12` because it treats `/12`
|
122
|
-
as an invalid symbol.
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rake/testtask'
|
2
4
|
require 'rake/extensiontask'
|
3
5
|
require 'rake/clean'
|
@@ -8,57 +10,58 @@ LIB_DIR = "lib/#{NAME}"
|
|
8
10
|
EXT_BUNDLE = "#{LIB_DIR}/#{NAME}.#{RbConfig::CONFIG['DLEXT']}"
|
9
11
|
|
10
12
|
EXT_PATH = "ext/#{NAME}"
|
11
|
-
RAGEL_PARSER_SRC =
|
13
|
+
RAGEL_PARSER_SRC = 'edn_parser.rl'
|
12
14
|
RAGEL_PARSER_SRC_PATH = "#{EXT_PATH}/#{RAGEL_PARSER_SRC}"
|
13
|
-
GEN_CC_PARSER_SRC =
|
15
|
+
GEN_CC_PARSER_SRC = 'edn_parser.cc'
|
14
16
|
GEN_CC_PARSER_SRC_PATH = "#{EXT_PATH}/#{GEN_CC_PARSER_SRC}"
|
15
17
|
|
16
18
|
task :irb do
|
17
|
-
sh
|
18
|
-
sh
|
19
|
+
sh 'irb -I lib -r edn_turbo'
|
20
|
+
sh 'reset'
|
19
21
|
end
|
20
22
|
|
21
|
-
task :
|
23
|
+
task runthru: %i[clean default test]
|
22
24
|
|
23
|
-
Rake::ExtensionTask.new(
|
25
|
+
Rake::ExtensionTask.new(NAME) do |extension|
|
24
26
|
extension.lib_dir = LIB_DIR
|
25
|
-
extension.source_pattern =
|
27
|
+
extension.source_pattern = '*.{cc,h}'
|
26
28
|
end
|
27
29
|
|
28
30
|
task :chmod do
|
29
|
-
File.chmod(
|
31
|
+
File.chmod(0o0775, EXT_BUNDLE)
|
30
32
|
end
|
31
33
|
|
32
|
-
CLEAN.include([
|
34
|
+
CLEAN.include(['*.png', '*.gem'])
|
33
35
|
|
34
36
|
# ragel cc source generation
|
35
|
-
task :
|
37
|
+
task ragel: GEN_CC_PARSER_SRC_PATH
|
36
38
|
file GEN_CC_PARSER_SRC_PATH => RAGEL_PARSER_SRC_PATH do
|
37
39
|
cd EXT_PATH do
|
38
40
|
sh "ragel -G2 -o #{GEN_CC_PARSER_SRC} #{RAGEL_PARSER_SRC}"
|
39
41
|
src = File.read(GEN_CC_PARSER_SRC).gsub(/[ \t]+$/, '')
|
40
|
-
File.open(GEN_CC_PARSER_SRC,
|
42
|
+
File.open(GEN_CC_PARSER_SRC, 'w') { |f| f.print src }
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
46
|
# graph generation for testing machine output
|
45
|
-
task :graph, [:machine] do |
|
46
|
-
args.with_defaults(:
|
47
|
-
TMPFILE='/tmp/ragel_edn'
|
48
|
-
MACHINE=args[:machine]
|
47
|
+
task :graph, [:machine] do |_t, args|
|
48
|
+
args.with_defaults(machine: 'EDN_value')
|
49
|
+
TMPFILE = '/tmp/ragel_edn'
|
50
|
+
MACHINE = args[:machine]
|
49
51
|
|
50
52
|
# assumes graphviz is installed
|
51
|
-
sh "ragel -Vp -S #{MACHINE} -o #{TMPFILE} #{EXT_PATH}/#{RAGEL_PARSER_SRC} &&
|
53
|
+
sh "ragel -Vp -S #{MACHINE} -o #{TMPFILE} #{EXT_PATH}/#{RAGEL_PARSER_SRC} && "\
|
54
|
+
"dot -Tpng #{TMPFILE} -o #{MACHINE}.png"
|
52
55
|
end
|
53
56
|
|
54
|
-
task :
|
57
|
+
task build: [:clean, :ragel, :compile, :chmod]
|
55
58
|
|
56
59
|
# add dependency to test task
|
57
|
-
task :
|
60
|
+
task test: EXT_BUNDLE
|
58
61
|
|
59
62
|
Rake::TestTask.new do |t|
|
60
63
|
t.libs << 'test'
|
61
64
|
t.test_files = FileList['test/test_output_diff.rb']
|
62
65
|
end
|
63
66
|
|
64
|
-
task :
|
67
|
+
task default: :compile
|
data/bin/console.sh
ADDED
data/docker-compose.yml
ADDED
data/ext/edn_turbo/edn_parser.cc
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
|
2
2
|
#line 1 "edn_parser.rl"
|
3
|
+
// The MIT License (MIT)
|
4
|
+
|
5
|
+
// Copyright (c) 2015-2019 Ed Porras
|
6
|
+
|
7
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
// of this software and associated documentation files (the "Software"), to deal
|
9
|
+
// in the Software without restriction, including without limitation the rights
|
10
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
// copies of the Software, and to permit persons to whom the Software is
|
12
|
+
// furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
// The above copyright notice and this permission notice shall be included in
|
15
|
+
// all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
// THE SOFTWARE.
|
24
|
+
|
3
25
|
#include <iostream>
|
4
26
|
#include <string>
|
5
27
|
#include <sstream>
|
@@ -21,7 +43,7 @@
|
|
21
43
|
//
|
22
44
|
|
23
45
|
|
24
|
-
#line
|
46
|
+
#line 81 "edn_parser.rl"
|
25
47
|
|
26
48
|
|
27
49
|
// ============================================================
|
@@ -29,7 +51,7 @@
|
|
29
51
|
//
|
30
52
|
|
31
53
|
|
32
|
-
#line
|
54
|
+
#line 55 "edn_parser.cc"
|
33
55
|
static const int EDN_value_start = 1;
|
34
56
|
static const int EDN_value_first_final = 2;
|
35
57
|
static const int EDN_value_error = 0;
|
@@ -37,7 +59,7 @@ static const int EDN_value_error = 0;
|
|
37
59
|
static const int EDN_value_en_main = 1;
|
38
60
|
|
39
61
|
|
40
|
-
#line
|
62
|
+
#line 197 "edn_parser.rl"
|
41
63
|
|
42
64
|
|
43
65
|
|
@@ -47,14 +69,14 @@ const char *edn::Parser::parse_value(const char *p, const char *pe, VALUE& v)
|
|
47
69
|
int cs;
|
48
70
|
|
49
71
|
|
50
|
-
#line
|
72
|
+
#line 73 "edn_parser.cc"
|
51
73
|
{
|
52
74
|
cs = EDN_value_start;
|
53
75
|
}
|
54
76
|
|
55
|
-
#line
|
77
|
+
#line 206 "edn_parser.rl"
|
56
78
|
|
57
|
-
#line
|
79
|
+
#line 80 "edn_parser.cc"
|
58
80
|
{
|
59
81
|
if ( p == pe )
|
60
82
|
goto _test_eof;
|
@@ -97,44 +119,44 @@ st0:
|
|
97
119
|
cs = 0;
|
98
120
|
goto _out;
|
99
121
|
tr0:
|
100
|
-
#line
|
122
|
+
#line 125 "edn_parser.rl"
|
101
123
|
{
|
102
124
|
// stand-alone operators *, +, -, etc.
|
103
125
|
const char *np = parse_operator(p, pe, v);
|
104
|
-
if (np ==
|
126
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
105
127
|
}
|
106
128
|
goto st2;
|
107
129
|
tr2:
|
108
|
-
#line
|
130
|
+
#line 93 "edn_parser.rl"
|
109
131
|
{
|
110
132
|
// string types within double-quotes
|
111
133
|
const char *np = parse_string(p, pe, v);
|
112
|
-
if (np ==
|
134
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
113
135
|
}
|
114
136
|
goto st2;
|
115
137
|
tr3:
|
116
|
-
#line
|
138
|
+
#line 177 "edn_parser.rl"
|
117
139
|
{
|
118
140
|
// handles tokens w/ leading # ("#_", "#{", and tagged elems)
|
119
141
|
const char *np = parse_dispatch(p + 1, pe, v);
|
120
|
-
if (np ==
|
142
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
121
143
|
}
|
122
144
|
goto st2;
|
123
145
|
tr4:
|
124
|
-
#line
|
146
|
+
#line 159 "edn_parser.rl"
|
125
147
|
{
|
126
148
|
// (
|
127
149
|
const char *np = parse_list(p, pe, v);
|
128
|
-
if (np ==
|
150
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
129
151
|
}
|
130
152
|
goto st2;
|
131
153
|
tr5:
|
132
|
-
#line
|
154
|
+
#line 105 "edn_parser.rl"
|
133
155
|
{
|
134
156
|
// tokens w/ leading digits: non-negative integers & decimals.
|
135
157
|
// try to parse a decimal first
|
136
158
|
const char *np = parse_decimal(p, pe, v);
|
137
|
-
if (np ==
|
159
|
+
if (np == nullptr) {
|
138
160
|
// if we can't, try to parse it as an int
|
139
161
|
np = parse_integer(p, pe, v);
|
140
162
|
}
|
@@ -151,20 +173,20 @@ tr5:
|
|
151
173
|
}
|
152
174
|
goto st2;
|
153
175
|
tr6:
|
154
|
-
#line
|
176
|
+
#line 99 "edn_parser.rl"
|
155
177
|
{
|
156
178
|
// tokens with a leading ':'
|
157
179
|
const char *np = parse_keyword(p, pe, v);
|
158
|
-
if (np ==
|
180
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
159
181
|
}
|
160
182
|
goto st2;
|
161
183
|
tr7:
|
162
|
-
#line
|
184
|
+
#line 137 "edn_parser.rl"
|
163
185
|
{
|
164
186
|
// user identifiers and reserved keywords (true, false, nil)
|
165
187
|
VALUE sym = Qnil;
|
166
188
|
const char *np = parse_symbol(p, pe, sym);
|
167
|
-
if (np ==
|
189
|
+
if (np == nullptr) { {p = (( pe))-1;} } else {
|
168
190
|
// parse_symbol will make 'sym' a ruby string
|
169
191
|
if (std::strcmp(RSTRING_PTR(sym), "true") == 0) { v = Qtrue; }
|
170
192
|
else if (std::strcmp(RSTRING_PTR(sym), "false") == 0) { v = Qfalse; }
|
@@ -177,44 +199,44 @@ tr7:
|
|
177
199
|
}
|
178
200
|
goto st2;
|
179
201
|
tr8:
|
180
|
-
#line
|
202
|
+
#line 153 "edn_parser.rl"
|
181
203
|
{
|
182
204
|
// [
|
183
205
|
const char *np = parse_vector(p, pe, v);
|
184
|
-
if (np ==
|
206
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
185
207
|
}
|
186
208
|
goto st2;
|
187
209
|
tr9:
|
188
|
-
#line
|
210
|
+
#line 131 "edn_parser.rl"
|
189
211
|
{
|
190
212
|
// tokens w/ leading \ (escaped characters \newline, \c, etc.)
|
191
213
|
const char *np = parse_esc_char(p, pe, v);
|
192
|
-
if (np ==
|
214
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
193
215
|
}
|
194
216
|
goto st2;
|
195
217
|
tr10:
|
196
|
-
#line
|
218
|
+
#line 171 "edn_parser.rl"
|
197
219
|
{
|
198
220
|
// ^
|
199
221
|
const char *np = parse_meta(p, pe);
|
200
|
-
if (np ==
|
222
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
201
223
|
}
|
202
224
|
goto st2;
|
203
225
|
tr11:
|
204
|
-
#line
|
226
|
+
#line 165 "edn_parser.rl"
|
205
227
|
{
|
206
228
|
// {
|
207
229
|
const char *np = parse_map(p, pe, v);
|
208
|
-
if (np ==
|
230
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
209
231
|
}
|
210
232
|
goto st2;
|
211
233
|
st2:
|
212
234
|
if ( ++p == pe )
|
213
235
|
goto _test_eof2;
|
214
236
|
case 2:
|
215
|
-
#line
|
237
|
+
#line 80 "edn_parser.rl"
|
216
238
|
{ p--; {p++; cs = 2; goto _out;} }
|
217
|
-
#line
|
239
|
+
#line 240 "edn_parser.cc"
|
218
240
|
goto st0;
|
219
241
|
}
|
220
242
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -223,7 +245,7 @@ case 2:
|
|
223
245
|
_out: {}
|
224
246
|
}
|
225
247
|
|
226
|
-
#line
|
248
|
+
#line 207 "edn_parser.rl"
|
227
249
|
|
228
250
|
if (cs >= EDN_value_first_final) {
|
229
251
|
return p;
|
@@ -233,7 +255,7 @@ case 2:
|
|
233
255
|
return pe;
|
234
256
|
}
|
235
257
|
else if (cs == EDN_value_en_main) {} // silence ragel warning
|
236
|
-
return
|
258
|
+
return nullptr;
|
237
259
|
}
|
238
260
|
|
239
261
|
|
@@ -245,7 +267,7 @@ case 2:
|
|
245
267
|
// ascii range is found.
|
246
268
|
//
|
247
269
|
|
248
|
-
#line
|
270
|
+
#line 271 "edn_parser.cc"
|
249
271
|
static const int EDN_string_start = 1;
|
250
272
|
static const int EDN_string_first_final = 8;
|
251
273
|
static const int EDN_string_error = 0;
|
@@ -253,7 +275,7 @@ static const int EDN_string_error = 0;
|
|
253
275
|
static const int EDN_string_en_main = 1;
|
254
276
|
|
255
277
|
|
256
|
-
#line
|
278
|
+
#line 252 "edn_parser.rl"
|
257
279
|
|
258
280
|
|
259
281
|
|
@@ -264,15 +286,15 @@ const char* edn::Parser::parse_string(const char *p, const char *pe, VALUE& v)
|
|
264
286
|
bool encode = false;
|
265
287
|
|
266
288
|
|
267
|
-
#line
|
289
|
+
#line 290 "edn_parser.cc"
|
268
290
|
{
|
269
291
|
cs = EDN_string_start;
|
270
292
|
}
|
271
293
|
|
272
|
-
#line
|
294
|
+
#line 262 "edn_parser.rl"
|
273
295
|
const char* p_save = p;
|
274
296
|
|
275
|
-
#line
|
297
|
+
#line 298 "edn_parser.cc"
|
276
298
|
{
|
277
299
|
if ( p == pe )
|
278
300
|
goto _test_eof;
|
@@ -286,7 +308,7 @@ st0:
|
|
286
308
|
cs = 0;
|
287
309
|
goto _out;
|
288
310
|
tr2:
|
289
|
-
#line
|
311
|
+
#line 241 "edn_parser.rl"
|
290
312
|
{
|
291
313
|
encode = true;
|
292
314
|
}
|
@@ -295,7 +317,7 @@ st2:
|
|
295
317
|
if ( ++p == pe )
|
296
318
|
goto _test_eof2;
|
297
319
|
case 2:
|
298
|
-
#line
|
320
|
+
#line 321 "edn_parser.cc"
|
299
321
|
switch( (*p) ) {
|
300
322
|
case 34: goto tr3;
|
301
323
|
case 92: goto tr4;
|
@@ -304,7 +326,7 @@ case 2:
|
|
304
326
|
goto tr2;
|
305
327
|
goto st2;
|
306
328
|
tr3:
|
307
|
-
#line
|
329
|
+
#line 233 "edn_parser.rl"
|
308
330
|
{
|
309
331
|
if (edn::util::parse_byte_stream(p_save + 1, p, v, encode)) {
|
310
332
|
{p = (( p + 1))-1;}
|
@@ -312,17 +334,17 @@ tr3:
|
|
312
334
|
p--; {p++; cs = 8; goto _out;}
|
313
335
|
}
|
314
336
|
}
|
315
|
-
#line
|
337
|
+
#line 80 "edn_parser.rl"
|
316
338
|
{ p--; {p++; cs = 8; goto _out;} }
|
317
339
|
goto st8;
|
318
340
|
st8:
|
319
341
|
if ( ++p == pe )
|
320
342
|
goto _test_eof8;
|
321
343
|
case 8:
|
322
|
-
#line
|
344
|
+
#line 345 "edn_parser.cc"
|
323
345
|
goto st0;
|
324
346
|
tr4:
|
325
|
-
#line
|
347
|
+
#line 241 "edn_parser.rl"
|
326
348
|
{
|
327
349
|
encode = true;
|
328
350
|
}
|
@@ -331,7 +353,7 @@ st3:
|
|
331
353
|
if ( ++p == pe )
|
332
354
|
goto _test_eof3;
|
333
355
|
case 3:
|
334
|
-
#line
|
356
|
+
#line 357 "edn_parser.cc"
|
335
357
|
switch( (*p) ) {
|
336
358
|
case 34: goto tr2;
|
337
359
|
case 47: goto tr2;
|
@@ -345,7 +367,7 @@ case 3:
|
|
345
367
|
}
|
346
368
|
goto st2;
|
347
369
|
tr5:
|
348
|
-
#line
|
370
|
+
#line 241 "edn_parser.rl"
|
349
371
|
{
|
350
372
|
encode = true;
|
351
373
|
}
|
@@ -354,7 +376,7 @@ st4:
|
|
354
376
|
if ( ++p == pe )
|
355
377
|
goto _test_eof4;
|
356
378
|
case 4:
|
357
|
-
#line
|
379
|
+
#line 380 "edn_parser.cc"
|
358
380
|
if ( (*p) < 65 ) {
|
359
381
|
if ( 48 <= (*p) && (*p) <= 57 )
|
360
382
|
goto tr6;
|
@@ -365,7 +387,7 @@ case 4:
|
|
365
387
|
goto tr6;
|
366
388
|
goto st0;
|
367
389
|
tr6:
|
368
|
-
#line
|
390
|
+
#line 241 "edn_parser.rl"
|
369
391
|
{
|
370
392
|
encode = true;
|
371
393
|
}
|
@@ -374,7 +396,7 @@ st5:
|
|
374
396
|
if ( ++p == pe )
|
375
397
|
goto _test_eof5;
|
376
398
|
case 5:
|
377
|
-
#line
|
399
|
+
#line 400 "edn_parser.cc"
|
378
400
|
if ( (*p) < 65 ) {
|
379
401
|
if ( 48 <= (*p) && (*p) <= 57 )
|
380
402
|
goto tr7;
|
@@ -385,7 +407,7 @@ case 5:
|
|
385
407
|
goto tr7;
|
386
408
|
goto st0;
|
387
409
|
tr7:
|
388
|
-
#line
|
410
|
+
#line 241 "edn_parser.rl"
|
389
411
|
{
|
390
412
|
encode = true;
|
391
413
|
}
|
@@ -394,7 +416,7 @@ st6:
|
|
394
416
|
if ( ++p == pe )
|
395
417
|
goto _test_eof6;
|
396
418
|
case 6:
|
397
|
-
#line
|
419
|
+
#line 420 "edn_parser.cc"
|
398
420
|
if ( (*p) < 65 ) {
|
399
421
|
if ( 48 <= (*p) && (*p) <= 57 )
|
400
422
|
goto tr8;
|
@@ -405,7 +427,7 @@ case 6:
|
|
405
427
|
goto tr8;
|
406
428
|
goto st0;
|
407
429
|
tr8:
|
408
|
-
#line
|
430
|
+
#line 241 "edn_parser.rl"
|
409
431
|
{
|
410
432
|
encode = true;
|
411
433
|
}
|
@@ -414,7 +436,7 @@ st7:
|
|
414
436
|
if ( ++p == pe )
|
415
437
|
goto _test_eof7;
|
416
438
|
case 7:
|
417
|
-
#line
|
439
|
+
#line 440 "edn_parser.cc"
|
418
440
|
if ( (*p) < 65 ) {
|
419
441
|
if ( 48 <= (*p) && (*p) <= 57 )
|
420
442
|
goto tr2;
|
@@ -438,7 +460,7 @@ case 7:
|
|
438
460
|
{
|
439
461
|
switch ( cs ) {
|
440
462
|
case 2:
|
441
|
-
#line
|
463
|
+
#line 73 "edn_parser.rl"
|
442
464
|
{
|
443
465
|
std::stringstream s;
|
444
466
|
s << "unterminated " << EDN_TYPE;
|
@@ -446,14 +468,14 @@ case 7:
|
|
446
468
|
p--; {p++; cs = 0; goto _out;}
|
447
469
|
}
|
448
470
|
break;
|
449
|
-
#line
|
471
|
+
#line 472 "edn_parser.cc"
|
450
472
|
}
|
451
473
|
}
|
452
474
|
|
453
475
|
_out: {}
|
454
476
|
}
|
455
477
|
|
456
|
-
#line
|
478
|
+
#line 264 "edn_parser.rl"
|
457
479
|
|
458
480
|
if (cs >= EDN_string_first_final) {
|
459
481
|
return p + 1;
|
@@ -462,7 +484,7 @@ case 7:
|
|
462
484
|
return pe;
|
463
485
|
}
|
464
486
|
else if (cs == EDN_string_en_main) {} // silence ragel warning
|
465
|
-
return
|
487
|
+
return nullptr;
|
466
488
|
}
|
467
489
|
|
468
490
|
|
@@ -471,7 +493,7 @@ case 7:
|
|
471
493
|
// keyword parsing
|
472
494
|
//
|
473
495
|
|
474
|
-
#line
|
496
|
+
#line 497 "edn_parser.cc"
|
475
497
|
static const int EDN_keyword_start = 1;
|
476
498
|
static const int EDN_keyword_first_final = 3;
|
477
499
|
static const int EDN_keyword_error = 0;
|
@@ -479,7 +501,7 @@ static const int EDN_keyword_error = 0;
|
|
479
501
|
static const int EDN_keyword_en_main = 1;
|
480
502
|
|
481
503
|
|
482
|
-
#line
|
504
|
+
#line 294 "edn_parser.rl"
|
483
505
|
|
484
506
|
|
485
507
|
|
@@ -488,15 +510,15 @@ const char* edn::Parser::parse_keyword(const char *p, const char *pe, VALUE& v)
|
|
488
510
|
int cs;
|
489
511
|
|
490
512
|
|
491
|
-
#line
|
513
|
+
#line 514 "edn_parser.cc"
|
492
514
|
{
|
493
515
|
cs = EDN_keyword_start;
|
494
516
|
}
|
495
517
|
|
496
|
-
#line
|
518
|
+
#line 302 "edn_parser.rl"
|
497
519
|
const char* p_save = p;
|
498
520
|
|
499
|
-
#line
|
521
|
+
#line 522 "edn_parser.cc"
|
500
522
|
{
|
501
523
|
if ( p == pe )
|
502
524
|
goto _test_eof;
|
@@ -563,14 +585,14 @@ case 3:
|
|
563
585
|
goto st3;
|
564
586
|
goto tr3;
|
565
587
|
tr3:
|
566
|
-
#line
|
588
|
+
#line 80 "edn_parser.rl"
|
567
589
|
{ p--; {p++; cs = 4; goto _out;} }
|
568
590
|
goto st4;
|
569
591
|
st4:
|
570
592
|
if ( ++p == pe )
|
571
593
|
goto _test_eof4;
|
572
594
|
case 4:
|
573
|
-
#line
|
595
|
+
#line 596 "edn_parser.cc"
|
574
596
|
goto st0;
|
575
597
|
st5:
|
576
598
|
if ( ++p == pe )
|
@@ -609,7 +631,7 @@ case 5:
|
|
609
631
|
_out: {}
|
610
632
|
}
|
611
633
|
|
612
|
-
#line
|
634
|
+
#line 304 "edn_parser.rl"
|
613
635
|
|
614
636
|
if (cs >= EDN_keyword_first_final) {
|
615
637
|
std::string buf;
|
@@ -624,7 +646,7 @@ case 5:
|
|
624
646
|
return pe;
|
625
647
|
}
|
626
648
|
else if (cs == EDN_keyword_en_main) {} // silence ragel warning
|
627
|
-
return
|
649
|
+
return nullptr;
|
628
650
|
}
|
629
651
|
|
630
652
|
|
@@ -633,14 +655,14 @@ case 5:
|
|
633
655
|
// decimal parsing machine
|
634
656
|
//
|
635
657
|
|
636
|
-
#line
|
658
|
+
#line 659 "edn_parser.cc"
|
637
659
|
static const int EDN_decimal_start = 1;
|
638
660
|
static const int EDN_decimal_first_final = 9;
|
639
661
|
|
640
662
|
static const int EDN_decimal_en_main = 1;
|
641
663
|
|
642
664
|
|
643
|
-
#line
|
665
|
+
#line 337 "edn_parser.rl"
|
644
666
|
|
645
667
|
|
646
668
|
|
@@ -649,15 +671,15 @@ const char* edn::Parser::parse_decimal(const char *p, const char *pe, VALUE& v)
|
|
649
671
|
int cs;
|
650
672
|
|
651
673
|
|
652
|
-
#line
|
674
|
+
#line 675 "edn_parser.cc"
|
653
675
|
{
|
654
676
|
cs = EDN_decimal_start;
|
655
677
|
}
|
656
678
|
|
657
|
-
#line
|
679
|
+
#line 345 "edn_parser.rl"
|
658
680
|
const char* p_save = p;
|
659
681
|
|
660
|
-
#line
|
682
|
+
#line 683 "edn_parser.cc"
|
661
683
|
{
|
662
684
|
if ( p == pe )
|
663
685
|
goto _test_eof;
|
@@ -711,14 +733,14 @@ case 9:
|
|
711
733
|
goto st0;
|
712
734
|
goto tr10;
|
713
735
|
tr10:
|
714
|
-
#line
|
736
|
+
#line 80 "edn_parser.rl"
|
715
737
|
{ p--; {p++; cs = 10; goto _out;} }
|
716
738
|
goto st10;
|
717
739
|
st10:
|
718
740
|
if ( ++p == pe )
|
719
741
|
goto _test_eof10;
|
720
742
|
case 10:
|
721
|
-
#line
|
743
|
+
#line 744 "edn_parser.cc"
|
722
744
|
goto st0;
|
723
745
|
st4:
|
724
746
|
if ( ++p == pe )
|
@@ -834,14 +856,14 @@ case 8:
|
|
834
856
|
_out: {}
|
835
857
|
}
|
836
858
|
|
837
|
-
#line
|
859
|
+
#line 347 "edn_parser.rl"
|
838
860
|
|
839
861
|
if (cs >= EDN_decimal_first_final) {
|
840
862
|
v = edn::util::float_to_ruby(p_save, p - p_save);
|
841
863
|
return p + 1;
|
842
864
|
}
|
843
865
|
else if (cs == EDN_decimal_en_main) {} // silence ragel warning
|
844
|
-
return
|
866
|
+
return nullptr;
|
845
867
|
}
|
846
868
|
|
847
869
|
|
@@ -849,14 +871,14 @@ case 8:
|
|
849
871
|
// integer parsing machine - M suffix will return a BigNum
|
850
872
|
//
|
851
873
|
|
852
|
-
#line
|
874
|
+
#line 875 "edn_parser.cc"
|
853
875
|
static const int EDN_integer_start = 1;
|
854
876
|
static const int EDN_integer_first_final = 3;
|
855
877
|
|
856
878
|
static const int EDN_integer_en_main = 1;
|
857
879
|
|
858
880
|
|
859
|
-
#line
|
881
|
+
#line 370 "edn_parser.rl"
|
860
882
|
|
861
883
|
|
862
884
|
const char* edn::Parser::parse_integer(const char *p, const char *pe, VALUE& v)
|
@@ -864,15 +886,15 @@ const char* edn::Parser::parse_integer(const char *p, const char *pe, VALUE& v)
|
|
864
886
|
int cs;
|
865
887
|
|
866
888
|
|
867
|
-
#line
|
889
|
+
#line 890 "edn_parser.cc"
|
868
890
|
{
|
869
891
|
cs = EDN_integer_start;
|
870
892
|
}
|
871
893
|
|
872
|
-
#line
|
894
|
+
#line 377 "edn_parser.rl"
|
873
895
|
const char* p_save = p;
|
874
896
|
|
875
|
-
#line
|
897
|
+
#line 898 "edn_parser.cc"
|
876
898
|
{
|
877
899
|
if ( p == pe )
|
878
900
|
goto _test_eof;
|
@@ -914,14 +936,14 @@ case 3:
|
|
914
936
|
goto st0;
|
915
937
|
goto tr4;
|
916
938
|
tr4:
|
917
|
-
#line
|
939
|
+
#line 80 "edn_parser.rl"
|
918
940
|
{ p--; {p++; cs = 4; goto _out;} }
|
919
941
|
goto st4;
|
920
942
|
st4:
|
921
943
|
if ( ++p == pe )
|
922
944
|
goto _test_eof4;
|
923
945
|
case 4:
|
924
|
-
#line
|
946
|
+
#line 947 "edn_parser.cc"
|
925
947
|
goto st0;
|
926
948
|
st5:
|
927
949
|
if ( ++p == pe )
|
@@ -962,14 +984,14 @@ case 6:
|
|
962
984
|
_out: {}
|
963
985
|
}
|
964
986
|
|
965
|
-
#line
|
987
|
+
#line 379 "edn_parser.rl"
|
966
988
|
|
967
989
|
if (cs >= EDN_integer_first_final) {
|
968
990
|
v = edn::util::integer_to_ruby(p_save, p - p_save);
|
969
991
|
return p + 1;
|
970
992
|
}
|
971
993
|
else if (cs == EDN_integer_en_main) {} // silence ragel warning
|
972
|
-
return
|
994
|
+
return nullptr;
|
973
995
|
}
|
974
996
|
|
975
997
|
|
@@ -982,7 +1004,7 @@ case 6:
|
|
982
1004
|
// 3. stand-alone operators: +, -, /, *, etc.
|
983
1005
|
//
|
984
1006
|
|
985
|
-
#line
|
1007
|
+
#line 1008 "edn_parser.cc"
|
986
1008
|
static const int EDN_operator_start = 1;
|
987
1009
|
static const int EDN_operator_first_final = 3;
|
988
1010
|
static const int EDN_operator_error = 0;
|
@@ -990,7 +1012,7 @@ static const int EDN_operator_error = 0;
|
|
990
1012
|
static const int EDN_operator_en_main = 1;
|
991
1013
|
|
992
1014
|
|
993
|
-
#line
|
1015
|
+
#line 453 "edn_parser.rl"
|
994
1016
|
|
995
1017
|
|
996
1018
|
|
@@ -999,15 +1021,15 @@ const char* edn::Parser::parse_operator(const char *p, const char *pe, VALUE& v)
|
|
999
1021
|
int cs;
|
1000
1022
|
|
1001
1023
|
|
1002
|
-
#line
|
1024
|
+
#line 1025 "edn_parser.cc"
|
1003
1025
|
{
|
1004
1026
|
cs = EDN_operator_start;
|
1005
1027
|
}
|
1006
1028
|
|
1007
|
-
#line
|
1029
|
+
#line 461 "edn_parser.rl"
|
1008
1030
|
const char* p_save = p;
|
1009
1031
|
|
1010
|
-
#line
|
1032
|
+
#line 1033 "edn_parser.cc"
|
1011
1033
|
{
|
1012
1034
|
if ( p == pe )
|
1013
1035
|
goto _test_eof;
|
@@ -1060,84 +1082,84 @@ case 3:
|
|
1060
1082
|
goto tr9;
|
1061
1083
|
goto tr6;
|
1062
1084
|
tr6:
|
1063
|
-
#line
|
1085
|
+
#line 437 "edn_parser.rl"
|
1064
1086
|
{
|
1065
1087
|
// stand-alone operators (-, +, /, ... etc)
|
1066
1088
|
char op[2] = { *p_save, 0 };
|
1067
1089
|
VALUE sym = rb_str_new2(op);
|
1068
1090
|
v = edn::util::call_module_fn(rb_mEDN, EDN_MAKE_SYMBOL_METHOD, sym);
|
1069
1091
|
}
|
1070
|
-
#line
|
1092
|
+
#line 80 "edn_parser.rl"
|
1071
1093
|
{ p--; {p++; cs = 4; goto _out;} }
|
1072
1094
|
goto st4;
|
1073
1095
|
tr11:
|
1074
|
-
#line
|
1096
|
+
#line 80 "edn_parser.rl"
|
1075
1097
|
{ p--; {p++; cs = 4; goto _out;} }
|
1076
1098
|
goto st4;
|
1077
1099
|
tr17:
|
1078
|
-
#line
|
1100
|
+
#line 403 "edn_parser.rl"
|
1079
1101
|
{
|
1080
1102
|
// parse a symbol including the leading operator (-, +, .)
|
1081
1103
|
VALUE sym = Qnil;
|
1082
1104
|
const char *np = parse_symbol(p_save, pe, sym);
|
1083
|
-
if (np ==
|
1105
|
+
if (np == nullptr) { {p = (( pe))-1;} } else {
|
1084
1106
|
if (sym != Qnil)
|
1085
1107
|
v = edn::util::call_module_fn(rb_mEDN, EDN_MAKE_SYMBOL_METHOD, sym);
|
1086
1108
|
{p = (( np))-1;}
|
1087
1109
|
}
|
1088
1110
|
}
|
1089
|
-
#line
|
1111
|
+
#line 80 "edn_parser.rl"
|
1090
1112
|
{ p--; {p++; cs = 4; goto _out;} }
|
1091
1113
|
goto st4;
|
1092
1114
|
st4:
|
1093
1115
|
if ( ++p == pe )
|
1094
1116
|
goto _test_eof4;
|
1095
1117
|
case 4:
|
1096
|
-
#line
|
1118
|
+
#line 1119 "edn_parser.cc"
|
1097
1119
|
goto st0;
|
1098
1120
|
tr5:
|
1099
|
-
#line
|
1121
|
+
#line 47 "edn_parser.rl"
|
1100
1122
|
{ line_number++; }
|
1101
1123
|
goto st5;
|
1102
1124
|
tr7:
|
1103
|
-
#line
|
1125
|
+
#line 437 "edn_parser.rl"
|
1104
1126
|
{
|
1105
1127
|
// stand-alone operators (-, +, /, ... etc)
|
1106
1128
|
char op[2] = { *p_save, 0 };
|
1107
1129
|
VALUE sym = rb_str_new2(op);
|
1108
1130
|
v = edn::util::call_module_fn(rb_mEDN, EDN_MAKE_SYMBOL_METHOD, sym);
|
1109
1131
|
}
|
1110
|
-
#line
|
1132
|
+
#line 80 "edn_parser.rl"
|
1111
1133
|
{ p--; {p++; cs = 5; goto _out;} }
|
1112
1134
|
goto st5;
|
1113
1135
|
tr8:
|
1114
|
-
#line
|
1136
|
+
#line 437 "edn_parser.rl"
|
1115
1137
|
{
|
1116
1138
|
// stand-alone operators (-, +, /, ... etc)
|
1117
1139
|
char op[2] = { *p_save, 0 };
|
1118
1140
|
VALUE sym = rb_str_new2(op);
|
1119
1141
|
v = edn::util::call_module_fn(rb_mEDN, EDN_MAKE_SYMBOL_METHOD, sym);
|
1120
1142
|
}
|
1121
|
-
#line
|
1143
|
+
#line 47 "edn_parser.rl"
|
1122
1144
|
{ line_number++; }
|
1123
|
-
#line
|
1145
|
+
#line 80 "edn_parser.rl"
|
1124
1146
|
{ p--; {p++; cs = 5; goto _out;} }
|
1125
1147
|
goto st5;
|
1126
1148
|
tr12:
|
1127
|
-
#line
|
1149
|
+
#line 80 "edn_parser.rl"
|
1128
1150
|
{ p--; {p++; cs = 5; goto _out;} }
|
1129
1151
|
goto st5;
|
1130
1152
|
tr13:
|
1131
|
-
#line
|
1153
|
+
#line 47 "edn_parser.rl"
|
1132
1154
|
{ line_number++; }
|
1133
|
-
#line
|
1155
|
+
#line 80 "edn_parser.rl"
|
1134
1156
|
{ p--; {p++; cs = 5; goto _out;} }
|
1135
1157
|
goto st5;
|
1136
1158
|
st5:
|
1137
1159
|
if ( ++p == pe )
|
1138
1160
|
goto _test_eof5;
|
1139
1161
|
case 5:
|
1140
|
-
#line
|
1162
|
+
#line 1163 "edn_parser.cc"
|
1141
1163
|
switch( (*p) ) {
|
1142
1164
|
case 10: goto tr13;
|
1143
1165
|
case 32: goto tr12;
|
@@ -1162,25 +1184,25 @@ case 5:
|
|
1162
1184
|
goto st0;
|
1163
1185
|
goto tr11;
|
1164
1186
|
tr10:
|
1165
|
-
#line
|
1187
|
+
#line 437 "edn_parser.rl"
|
1166
1188
|
{
|
1167
1189
|
// stand-alone operators (-, +, /, ... etc)
|
1168
1190
|
char op[2] = { *p_save, 0 };
|
1169
1191
|
VALUE sym = rb_str_new2(op);
|
1170
1192
|
v = edn::util::call_module_fn(rb_mEDN, EDN_MAKE_SYMBOL_METHOD, sym);
|
1171
1193
|
}
|
1172
|
-
#line
|
1194
|
+
#line 80 "edn_parser.rl"
|
1173
1195
|
{ p--; {p++; cs = 6; goto _out;} }
|
1174
1196
|
goto st6;
|
1175
1197
|
tr14:
|
1176
|
-
#line
|
1198
|
+
#line 80 "edn_parser.rl"
|
1177
1199
|
{ p--; {p++; cs = 6; goto _out;} }
|
1178
1200
|
goto st6;
|
1179
1201
|
st6:
|
1180
1202
|
if ( ++p == pe )
|
1181
1203
|
goto _test_eof6;
|
1182
1204
|
case 6:
|
1183
|
-
#line
|
1205
|
+
#line 1206 "edn_parser.cc"
|
1184
1206
|
if ( (*p) == 10 )
|
1185
1207
|
goto tr5;
|
1186
1208
|
goto st2;
|
@@ -1192,12 +1214,12 @@ case 2:
|
|
1192
1214
|
goto tr5;
|
1193
1215
|
goto st2;
|
1194
1216
|
tr9:
|
1195
|
-
#line
|
1217
|
+
#line 403 "edn_parser.rl"
|
1196
1218
|
{
|
1197
1219
|
// parse a symbol including the leading operator (-, +, .)
|
1198
1220
|
VALUE sym = Qnil;
|
1199
1221
|
const char *np = parse_symbol(p_save, pe, sym);
|
1200
|
-
if (np ==
|
1222
|
+
if (np == nullptr) { {p = (( pe))-1;} } else {
|
1201
1223
|
if (sym != Qnil)
|
1202
1224
|
v = edn::util::call_module_fn(rb_mEDN, EDN_MAKE_SYMBOL_METHOD, sym);
|
1203
1225
|
{p = (( np))-1;}
|
@@ -1205,7 +1227,7 @@ tr9:
|
|
1205
1227
|
}
|
1206
1228
|
goto st7;
|
1207
1229
|
tr16:
|
1208
|
-
#line
|
1230
|
+
#line 414 "edn_parser.rl"
|
1209
1231
|
{
|
1210
1232
|
// parse a number with the leading symbol - this is slightly
|
1211
1233
|
// different than the one within EDN_value since it includes
|
@@ -1213,7 +1235,7 @@ tr16:
|
|
1213
1235
|
//
|
1214
1236
|
// try to parse a decimal first
|
1215
1237
|
const char *np = parse_decimal(p_save, pe, v);
|
1216
|
-
if (np ==
|
1238
|
+
if (np == nullptr) {
|
1217
1239
|
// if we can't, try to parse it as an int
|
1218
1240
|
np = parse_integer(p_save, pe, v);
|
1219
1241
|
}
|
@@ -1233,7 +1255,7 @@ st7:
|
|
1233
1255
|
if ( ++p == pe )
|
1234
1256
|
goto _test_eof7;
|
1235
1257
|
case 7:
|
1236
|
-
#line
|
1258
|
+
#line 1259 "edn_parser.cc"
|
1237
1259
|
switch( (*p) ) {
|
1238
1260
|
case 33: goto st0;
|
1239
1261
|
case 95: goto st0;
|
@@ -1316,12 +1338,12 @@ case 9:
|
|
1316
1338
|
goto tr18;
|
1317
1339
|
goto tr17;
|
1318
1340
|
tr18:
|
1319
|
-
#line
|
1341
|
+
#line 403 "edn_parser.rl"
|
1320
1342
|
{
|
1321
1343
|
// parse a symbol including the leading operator (-, +, .)
|
1322
1344
|
VALUE sym = Qnil;
|
1323
1345
|
const char *np = parse_symbol(p_save, pe, sym);
|
1324
|
-
if (np ==
|
1346
|
+
if (np == nullptr) { {p = (( pe))-1;} } else {
|
1325
1347
|
if (sym != Qnil)
|
1326
1348
|
v = edn::util::call_module_fn(rb_mEDN, EDN_MAKE_SYMBOL_METHOD, sym);
|
1327
1349
|
{p = (( np))-1;}
|
@@ -1332,7 +1354,7 @@ st10:
|
|
1332
1354
|
if ( ++p == pe )
|
1333
1355
|
goto _test_eof10;
|
1334
1356
|
case 10:
|
1335
|
-
#line
|
1357
|
+
#line 1358 "edn_parser.cc"
|
1336
1358
|
switch( (*p) ) {
|
1337
1359
|
case 33: goto st10;
|
1338
1360
|
case 95: goto st10;
|
@@ -1405,12 +1427,12 @@ case 11:
|
|
1405
1427
|
{
|
1406
1428
|
switch ( cs ) {
|
1407
1429
|
case 9:
|
1408
|
-
#line
|
1430
|
+
#line 403 "edn_parser.rl"
|
1409
1431
|
{
|
1410
1432
|
// parse a symbol including the leading operator (-, +, .)
|
1411
1433
|
VALUE sym = Qnil;
|
1412
1434
|
const char *np = parse_symbol(p_save, pe, sym);
|
1413
|
-
if (np ==
|
1435
|
+
if (np == nullptr) { {p = (( pe))-1;} } else {
|
1414
1436
|
if (sym != Qnil)
|
1415
1437
|
v = edn::util::call_module_fn(rb_mEDN, EDN_MAKE_SYMBOL_METHOD, sym);
|
1416
1438
|
{p = (( np))-1;}
|
@@ -1420,7 +1442,7 @@ case 11:
|
|
1420
1442
|
case 3:
|
1421
1443
|
case 8:
|
1422
1444
|
case 11:
|
1423
|
-
#line
|
1445
|
+
#line 437 "edn_parser.rl"
|
1424
1446
|
{
|
1425
1447
|
// stand-alone operators (-, +, /, ... etc)
|
1426
1448
|
char op[2] = { *p_save, 0 };
|
@@ -1428,14 +1450,14 @@ case 11:
|
|
1428
1450
|
v = edn::util::call_module_fn(rb_mEDN, EDN_MAKE_SYMBOL_METHOD, sym);
|
1429
1451
|
}
|
1430
1452
|
break;
|
1431
|
-
#line
|
1453
|
+
#line 1454 "edn_parser.cc"
|
1432
1454
|
}
|
1433
1455
|
}
|
1434
1456
|
|
1435
1457
|
_out: {}
|
1436
1458
|
}
|
1437
1459
|
|
1438
|
-
#line
|
1460
|
+
#line 463 "edn_parser.rl"
|
1439
1461
|
|
1440
1462
|
if (cs >= EDN_operator_first_final) {
|
1441
1463
|
return p;
|
@@ -1445,7 +1467,7 @@ case 11:
|
|
1445
1467
|
return pe;
|
1446
1468
|
}
|
1447
1469
|
else if (cs == EDN_operator_en_main) {} // silence ragel warning
|
1448
|
-
return
|
1470
|
+
return nullptr;
|
1449
1471
|
}
|
1450
1472
|
|
1451
1473
|
|
@@ -1454,7 +1476,7 @@ case 11:
|
|
1454
1476
|
// escaped char parsing - handles \c, \newline, \formfeed, etc.
|
1455
1477
|
//
|
1456
1478
|
|
1457
|
-
#line
|
1479
|
+
#line 1480 "edn_parser.cc"
|
1458
1480
|
static const int EDN_escaped_char_start = 1;
|
1459
1481
|
static const int EDN_escaped_char_first_final = 26;
|
1460
1482
|
static const int EDN_escaped_char_error = 0;
|
@@ -1462,7 +1484,7 @@ static const int EDN_escaped_char_error = 0;
|
|
1462
1484
|
static const int EDN_escaped_char_en_main = 1;
|
1463
1485
|
|
1464
1486
|
|
1465
|
-
#line
|
1487
|
+
#line 493 "edn_parser.rl"
|
1466
1488
|
|
1467
1489
|
|
1468
1490
|
|
@@ -1471,15 +1493,15 @@ const char* edn::Parser::parse_esc_char(const char *p, const char *pe, VALUE& v)
|
|
1471
1493
|
int cs;
|
1472
1494
|
|
1473
1495
|
|
1474
|
-
#line
|
1496
|
+
#line 1497 "edn_parser.cc"
|
1475
1497
|
{
|
1476
1498
|
cs = EDN_escaped_char_start;
|
1477
1499
|
}
|
1478
1500
|
|
1479
|
-
#line
|
1501
|
+
#line 501 "edn_parser.rl"
|
1480
1502
|
const char* p_save = p;
|
1481
1503
|
|
1482
|
-
#line
|
1504
|
+
#line 1505 "edn_parser.cc"
|
1483
1505
|
{
|
1484
1506
|
if ( p == pe )
|
1485
1507
|
goto _test_eof;
|
@@ -1524,20 +1546,20 @@ case 26:
|
|
1524
1546
|
goto tr28;
|
1525
1547
|
goto st0;
|
1526
1548
|
tr10:
|
1527
|
-
#line
|
1549
|
+
#line 47 "edn_parser.rl"
|
1528
1550
|
{ line_number++; }
|
1529
|
-
#line
|
1551
|
+
#line 80 "edn_parser.rl"
|
1530
1552
|
{ p--; {p++; cs = 27; goto _out;} }
|
1531
1553
|
goto st27;
|
1532
1554
|
tr28:
|
1533
|
-
#line
|
1555
|
+
#line 80 "edn_parser.rl"
|
1534
1556
|
{ p--; {p++; cs = 27; goto _out;} }
|
1535
1557
|
goto st27;
|
1536
1558
|
st27:
|
1537
1559
|
if ( ++p == pe )
|
1538
1560
|
goto _test_eof27;
|
1539
1561
|
case 27:
|
1540
|
-
#line
|
1562
|
+
#line 1563 "edn_parser.cc"
|
1541
1563
|
switch( (*p) ) {
|
1542
1564
|
case 10: goto tr10;
|
1543
1565
|
case 32: goto tr28;
|
@@ -1555,14 +1577,14 @@ case 3:
|
|
1555
1577
|
goto tr10;
|
1556
1578
|
goto st3;
|
1557
1579
|
tr29:
|
1558
|
-
#line
|
1580
|
+
#line 80 "edn_parser.rl"
|
1559
1581
|
{ p--; {p++; cs = 28; goto _out;} }
|
1560
1582
|
goto st28;
|
1561
1583
|
st28:
|
1562
1584
|
if ( ++p == pe )
|
1563
1585
|
goto _test_eof28;
|
1564
1586
|
case 28:
|
1565
|
-
#line
|
1587
|
+
#line 1588 "edn_parser.cc"
|
1566
1588
|
goto st0;
|
1567
1589
|
st29:
|
1568
1590
|
if ( ++p == pe )
|
@@ -1871,7 +1893,7 @@ case 25:
|
|
1871
1893
|
_out: {}
|
1872
1894
|
}
|
1873
1895
|
|
1874
|
-
#line
|
1896
|
+
#line 503 "edn_parser.rl"
|
1875
1897
|
|
1876
1898
|
if (cs >= EDN_escaped_char_first_final) {
|
1877
1899
|
// convert the escaped value to a character
|
@@ -1885,7 +1907,7 @@ case 25:
|
|
1885
1907
|
return pe;
|
1886
1908
|
}
|
1887
1909
|
else if (cs == EDN_escaped_char_en_main) {} // silence ragel warning
|
1888
|
-
return
|
1910
|
+
return nullptr;
|
1889
1911
|
}
|
1890
1912
|
|
1891
1913
|
|
@@ -1898,7 +1920,7 @@ case 25:
|
|
1898
1920
|
//
|
1899
1921
|
//
|
1900
1922
|
|
1901
|
-
#line
|
1923
|
+
#line 1924 "edn_parser.cc"
|
1902
1924
|
static const int EDN_symbol_start = 1;
|
1903
1925
|
static const int EDN_symbol_first_final = 4;
|
1904
1926
|
static const int EDN_symbol_error = 0;
|
@@ -1906,7 +1928,7 @@ static const int EDN_symbol_error = 0;
|
|
1906
1928
|
static const int EDN_symbol_en_main = 1;
|
1907
1929
|
|
1908
1930
|
|
1909
|
-
#line
|
1931
|
+
#line 554 "edn_parser.rl"
|
1910
1932
|
|
1911
1933
|
|
1912
1934
|
|
@@ -1915,15 +1937,15 @@ const char* edn::Parser::parse_symbol(const char *p, const char *pe, VALUE& s)
|
|
1915
1937
|
int cs;
|
1916
1938
|
|
1917
1939
|
|
1918
|
-
#line
|
1940
|
+
#line 1941 "edn_parser.cc"
|
1919
1941
|
{
|
1920
1942
|
cs = EDN_symbol_start;
|
1921
1943
|
}
|
1922
1944
|
|
1923
|
-
#line
|
1945
|
+
#line 562 "edn_parser.rl"
|
1924
1946
|
const char* p_save = p;
|
1925
1947
|
|
1926
|
-
#line
|
1948
|
+
#line 1949 "edn_parser.cc"
|
1927
1949
|
{
|
1928
1950
|
if ( p == pe )
|
1929
1951
|
goto _test_eof;
|
@@ -1985,34 +2007,34 @@ case 4:
|
|
1985
2007
|
goto st4;
|
1986
2008
|
goto tr7;
|
1987
2009
|
tr7:
|
1988
|
-
#line
|
2010
|
+
#line 80 "edn_parser.rl"
|
1989
2011
|
{ p--; {p++; cs = 5; goto _out;} }
|
1990
2012
|
goto st5;
|
1991
2013
|
st5:
|
1992
2014
|
if ( ++p == pe )
|
1993
2015
|
goto _test_eof5;
|
1994
2016
|
case 5:
|
1995
|
-
#line
|
2017
|
+
#line 2018 "edn_parser.cc"
|
1996
2018
|
goto st0;
|
1997
2019
|
tr4:
|
1998
|
-
#line
|
2020
|
+
#line 47 "edn_parser.rl"
|
1999
2021
|
{ line_number++; }
|
2000
2022
|
goto st6;
|
2001
2023
|
tr8:
|
2002
|
-
#line
|
2024
|
+
#line 80 "edn_parser.rl"
|
2003
2025
|
{ p--; {p++; cs = 6; goto _out;} }
|
2004
2026
|
goto st6;
|
2005
2027
|
tr9:
|
2006
|
-
#line
|
2028
|
+
#line 47 "edn_parser.rl"
|
2007
2029
|
{ line_number++; }
|
2008
|
-
#line
|
2030
|
+
#line 80 "edn_parser.rl"
|
2009
2031
|
{ p--; {p++; cs = 6; goto _out;} }
|
2010
2032
|
goto st6;
|
2011
2033
|
st6:
|
2012
2034
|
if ( ++p == pe )
|
2013
2035
|
goto _test_eof6;
|
2014
2036
|
case 6:
|
2015
|
-
#line
|
2037
|
+
#line 2038 "edn_parser.cc"
|
2016
2038
|
switch( (*p) ) {
|
2017
2039
|
case 10: goto tr9;
|
2018
2040
|
case 32: goto tr8;
|
@@ -2037,14 +2059,14 @@ case 6:
|
|
2037
2059
|
goto st0;
|
2038
2060
|
goto tr7;
|
2039
2061
|
tr11:
|
2040
|
-
#line
|
2062
|
+
#line 80 "edn_parser.rl"
|
2041
2063
|
{ p--; {p++; cs = 7; goto _out;} }
|
2042
2064
|
goto st7;
|
2043
2065
|
st7:
|
2044
2066
|
if ( ++p == pe )
|
2045
2067
|
goto _test_eof7;
|
2046
2068
|
case 7:
|
2047
|
-
#line
|
2069
|
+
#line 2070 "edn_parser.cc"
|
2048
2070
|
if ( (*p) == 10 )
|
2049
2071
|
goto tr4;
|
2050
2072
|
goto st2;
|
@@ -2152,7 +2174,7 @@ case 9:
|
|
2152
2174
|
_out: {}
|
2153
2175
|
}
|
2154
2176
|
|
2155
|
-
#line
|
2177
|
+
#line 564 "edn_parser.rl"
|
2156
2178
|
|
2157
2179
|
if (cs >= EDN_symbol_first_final) {
|
2158
2180
|
// copy the symbol text
|
@@ -2165,7 +2187,7 @@ case 9:
|
|
2165
2187
|
error(__FUNCTION__, "invalid symbol sequence", *p);
|
2166
2188
|
}
|
2167
2189
|
else if (cs == EDN_symbol_en_main) {} // silence ragel warning
|
2168
|
-
return
|
2190
|
+
return nullptr;
|
2169
2191
|
}
|
2170
2192
|
|
2171
2193
|
|
@@ -2177,13 +2199,13 @@ case 9:
|
|
2177
2199
|
// sets the same array is used)
|
2178
2200
|
//
|
2179
2201
|
|
2180
|
-
#line
|
2202
|
+
#line 642 "edn_parser.rl"
|
2181
2203
|
|
2182
2204
|
|
2183
2205
|
//
|
2184
2206
|
// vector-specific machine
|
2185
2207
|
|
2186
|
-
#line
|
2208
|
+
#line 2209 "edn_parser.cc"
|
2187
2209
|
static const int EDN_vector_start = 1;
|
2188
2210
|
static const int EDN_vector_first_final = 4;
|
2189
2211
|
static const int EDN_vector_error = 0;
|
@@ -2191,7 +2213,7 @@ static const int EDN_vector_error = 0;
|
|
2191
2213
|
static const int EDN_vector_en_main = 1;
|
2192
2214
|
|
2193
2215
|
|
2194
|
-
#line
|
2216
|
+
#line 657 "edn_parser.rl"
|
2195
2217
|
|
2196
2218
|
|
2197
2219
|
|
@@ -2206,14 +2228,14 @@ const char* edn::Parser::parse_vector(const char *p, const char *pe, VALUE& v)
|
|
2206
2228
|
VALUE elems; // will store the vector's elements - allocated in @open_seq
|
2207
2229
|
|
2208
2230
|
|
2209
|
-
#line
|
2231
|
+
#line 2232 "edn_parser.cc"
|
2210
2232
|
{
|
2211
2233
|
cs = EDN_vector_start;
|
2212
2234
|
}
|
2213
2235
|
|
2214
|
-
#line
|
2236
|
+
#line 671 "edn_parser.rl"
|
2215
2237
|
|
2216
|
-
#line
|
2238
|
+
#line 2239 "edn_parser.cc"
|
2217
2239
|
{
|
2218
2240
|
if ( p == pe )
|
2219
2241
|
goto _test_eof;
|
@@ -2224,7 +2246,7 @@ case 1:
|
|
2224
2246
|
goto tr0;
|
2225
2247
|
goto st0;
|
2226
2248
|
tr2:
|
2227
|
-
#line
|
2249
|
+
#line 73 "edn_parser.rl"
|
2228
2250
|
{
|
2229
2251
|
std::stringstream s;
|
2230
2252
|
s << "unterminated " << EDN_TYPE;
|
@@ -2232,12 +2254,12 @@ tr2:
|
|
2232
2254
|
p--; {p++; cs = 0; goto _out;}
|
2233
2255
|
}
|
2234
2256
|
goto st0;
|
2235
|
-
#line
|
2257
|
+
#line 2258 "edn_parser.cc"
|
2236
2258
|
st0:
|
2237
2259
|
cs = 0;
|
2238
2260
|
goto _out;
|
2239
2261
|
tr0:
|
2240
|
-
#line
|
2262
|
+
#line 591 "edn_parser.rl"
|
2241
2263
|
{
|
2242
2264
|
// sequences store elements in an array, then process it to
|
2243
2265
|
// convert it to a list, set, or map as needed once the
|
@@ -2249,11 +2271,11 @@ tr0:
|
|
2249
2271
|
}
|
2250
2272
|
goto st2;
|
2251
2273
|
tr4:
|
2252
|
-
#line
|
2274
|
+
#line 47 "edn_parser.rl"
|
2253
2275
|
{ line_number++; }
|
2254
2276
|
goto st2;
|
2255
2277
|
tr5:
|
2256
|
-
#line
|
2278
|
+
#line 606 "edn_parser.rl"
|
2257
2279
|
{
|
2258
2280
|
// reads an item within a sequence (vector, list, map, or
|
2259
2281
|
// set). Regardless of the sequence type, an array of the
|
@@ -2262,7 +2284,7 @@ tr5:
|
|
2262
2284
|
VALUE e;
|
2263
2285
|
std::size_t meta_sz = meta_size();
|
2264
2286
|
const char *np = parse_value(p, pe, e);
|
2265
|
-
if (np ==
|
2287
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {
|
2266
2288
|
// if there's an entry in the discard list, the current
|
2267
2289
|
// object is not meant to be kept due to a #_ so don't
|
2268
2290
|
// push it into the list of elements
|
@@ -2291,7 +2313,7 @@ st2:
|
|
2291
2313
|
if ( ++p == pe )
|
2292
2314
|
goto _test_eof2;
|
2293
2315
|
case 2:
|
2294
|
-
#line
|
2316
|
+
#line 2317 "edn_parser.cc"
|
2295
2317
|
switch( (*p) ) {
|
2296
2318
|
case 10: goto tr4;
|
2297
2319
|
case 32: goto st2;
|
@@ -2322,19 +2344,19 @@ case 3:
|
|
2322
2344
|
goto tr4;
|
2323
2345
|
goto st3;
|
2324
2346
|
tr7:
|
2325
|
-
#line
|
2347
|
+
#line 601 "edn_parser.rl"
|
2326
2348
|
{
|
2327
2349
|
// remove the current metadata level
|
2328
2350
|
del_top_meta_list();
|
2329
2351
|
}
|
2330
|
-
#line
|
2352
|
+
#line 80 "edn_parser.rl"
|
2331
2353
|
{ p--; {p++; cs = 4; goto _out;} }
|
2332
2354
|
goto st4;
|
2333
2355
|
st4:
|
2334
2356
|
if ( ++p == pe )
|
2335
2357
|
goto _test_eof4;
|
2336
2358
|
case 4:
|
2337
|
-
#line
|
2359
|
+
#line 2360 "edn_parser.cc"
|
2338
2360
|
goto st0;
|
2339
2361
|
}
|
2340
2362
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -2347,7 +2369,7 @@ case 4:
|
|
2347
2369
|
switch ( cs ) {
|
2348
2370
|
case 2:
|
2349
2371
|
case 3:
|
2350
|
-
#line
|
2372
|
+
#line 73 "edn_parser.rl"
|
2351
2373
|
{
|
2352
2374
|
std::stringstream s;
|
2353
2375
|
s << "unterminated " << EDN_TYPE;
|
@@ -2355,14 +2377,14 @@ case 4:
|
|
2355
2377
|
p--; {p++; cs = 0; goto _out;}
|
2356
2378
|
}
|
2357
2379
|
break;
|
2358
|
-
#line
|
2380
|
+
#line 2381 "edn_parser.cc"
|
2359
2381
|
}
|
2360
2382
|
}
|
2361
2383
|
|
2362
2384
|
_out: {}
|
2363
2385
|
}
|
2364
2386
|
|
2365
|
-
#line
|
2387
|
+
#line 672 "edn_parser.rl"
|
2366
2388
|
|
2367
2389
|
if (cs >= EDN_vector_first_final) {
|
2368
2390
|
v = elems;
|
@@ -2373,7 +2395,7 @@ case 4:
|
|
2373
2395
|
return pe;
|
2374
2396
|
}
|
2375
2397
|
else if (cs == EDN_vector_en_main) {} // silence ragel warning
|
2376
|
-
return
|
2398
|
+
return nullptr;
|
2377
2399
|
}
|
2378
2400
|
|
2379
2401
|
|
@@ -2382,7 +2404,7 @@ case 4:
|
|
2382
2404
|
// list parsing machine
|
2383
2405
|
//
|
2384
2406
|
|
2385
|
-
#line
|
2407
|
+
#line 2408 "edn_parser.cc"
|
2386
2408
|
static const int EDN_list_start = 1;
|
2387
2409
|
static const int EDN_list_first_final = 4;
|
2388
2410
|
static const int EDN_list_error = 0;
|
@@ -2390,7 +2412,7 @@ static const int EDN_list_error = 0;
|
|
2390
2412
|
static const int EDN_list_en_main = 1;
|
2391
2413
|
|
2392
2414
|
|
2393
|
-
#line
|
2415
|
+
#line 701 "edn_parser.rl"
|
2394
2416
|
|
2395
2417
|
|
2396
2418
|
//
|
@@ -2404,14 +2426,14 @@ const char* edn::Parser::parse_list(const char *p, const char *pe, VALUE& v)
|
|
2404
2426
|
VALUE elems; // stores the list's elements - allocated in @open_seq
|
2405
2427
|
|
2406
2428
|
|
2407
|
-
#line
|
2429
|
+
#line 2430 "edn_parser.cc"
|
2408
2430
|
{
|
2409
2431
|
cs = EDN_list_start;
|
2410
2432
|
}
|
2411
2433
|
|
2412
|
-
#line
|
2434
|
+
#line 714 "edn_parser.rl"
|
2413
2435
|
|
2414
|
-
#line
|
2436
|
+
#line 2437 "edn_parser.cc"
|
2415
2437
|
{
|
2416
2438
|
if ( p == pe )
|
2417
2439
|
goto _test_eof;
|
@@ -2422,7 +2444,7 @@ case 1:
|
|
2422
2444
|
goto tr0;
|
2423
2445
|
goto st0;
|
2424
2446
|
tr2:
|
2425
|
-
#line
|
2447
|
+
#line 73 "edn_parser.rl"
|
2426
2448
|
{
|
2427
2449
|
std::stringstream s;
|
2428
2450
|
s << "unterminated " << EDN_TYPE;
|
@@ -2430,12 +2452,12 @@ tr2:
|
|
2430
2452
|
p--; {p++; cs = 0; goto _out;}
|
2431
2453
|
}
|
2432
2454
|
goto st0;
|
2433
|
-
#line
|
2455
|
+
#line 2456 "edn_parser.cc"
|
2434
2456
|
st0:
|
2435
2457
|
cs = 0;
|
2436
2458
|
goto _out;
|
2437
2459
|
tr0:
|
2438
|
-
#line
|
2460
|
+
#line 591 "edn_parser.rl"
|
2439
2461
|
{
|
2440
2462
|
// sequences store elements in an array, then process it to
|
2441
2463
|
// convert it to a list, set, or map as needed once the
|
@@ -2447,11 +2469,11 @@ tr0:
|
|
2447
2469
|
}
|
2448
2470
|
goto st2;
|
2449
2471
|
tr4:
|
2450
|
-
#line
|
2472
|
+
#line 47 "edn_parser.rl"
|
2451
2473
|
{ line_number++; }
|
2452
2474
|
goto st2;
|
2453
2475
|
tr5:
|
2454
|
-
#line
|
2476
|
+
#line 606 "edn_parser.rl"
|
2455
2477
|
{
|
2456
2478
|
// reads an item within a sequence (vector, list, map, or
|
2457
2479
|
// set). Regardless of the sequence type, an array of the
|
@@ -2460,7 +2482,7 @@ tr5:
|
|
2460
2482
|
VALUE e;
|
2461
2483
|
std::size_t meta_sz = meta_size();
|
2462
2484
|
const char *np = parse_value(p, pe, e);
|
2463
|
-
if (np ==
|
2485
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {
|
2464
2486
|
// if there's an entry in the discard list, the current
|
2465
2487
|
// object is not meant to be kept due to a #_ so don't
|
2466
2488
|
// push it into the list of elements
|
@@ -2489,7 +2511,7 @@ st2:
|
|
2489
2511
|
if ( ++p == pe )
|
2490
2512
|
goto _test_eof2;
|
2491
2513
|
case 2:
|
2492
|
-
#line
|
2514
|
+
#line 2515 "edn_parser.cc"
|
2493
2515
|
switch( (*p) ) {
|
2494
2516
|
case 10: goto tr4;
|
2495
2517
|
case 32: goto st2;
|
@@ -2513,19 +2535,19 @@ case 2:
|
|
2513
2535
|
goto tr5;
|
2514
2536
|
goto tr2;
|
2515
2537
|
tr6:
|
2516
|
-
#line
|
2538
|
+
#line 601 "edn_parser.rl"
|
2517
2539
|
{
|
2518
2540
|
// remove the current metadata level
|
2519
2541
|
del_top_meta_list();
|
2520
2542
|
}
|
2521
|
-
#line
|
2543
|
+
#line 80 "edn_parser.rl"
|
2522
2544
|
{ p--; {p++; cs = 4; goto _out;} }
|
2523
2545
|
goto st4;
|
2524
2546
|
st4:
|
2525
2547
|
if ( ++p == pe )
|
2526
2548
|
goto _test_eof4;
|
2527
2549
|
case 4:
|
2528
|
-
#line
|
2550
|
+
#line 2551 "edn_parser.cc"
|
2529
2551
|
goto st0;
|
2530
2552
|
st3:
|
2531
2553
|
if ( ++p == pe )
|
@@ -2545,7 +2567,7 @@ case 3:
|
|
2545
2567
|
switch ( cs ) {
|
2546
2568
|
case 2:
|
2547
2569
|
case 3:
|
2548
|
-
#line
|
2570
|
+
#line 73 "edn_parser.rl"
|
2549
2571
|
{
|
2550
2572
|
std::stringstream s;
|
2551
2573
|
s << "unterminated " << EDN_TYPE;
|
@@ -2553,14 +2575,14 @@ case 3:
|
|
2553
2575
|
p--; {p++; cs = 0; goto _out;}
|
2554
2576
|
}
|
2555
2577
|
break;
|
2556
|
-
#line
|
2578
|
+
#line 2579 "edn_parser.cc"
|
2557
2579
|
}
|
2558
2580
|
}
|
2559
2581
|
|
2560
2582
|
_out: {}
|
2561
2583
|
}
|
2562
2584
|
|
2563
|
-
#line
|
2585
|
+
#line 715 "edn_parser.rl"
|
2564
2586
|
|
2565
2587
|
if (cs >= EDN_list_first_final) {
|
2566
2588
|
v = elems;
|
@@ -2573,7 +2595,7 @@ case 3:
|
|
2573
2595
|
return pe;
|
2574
2596
|
}
|
2575
2597
|
else if (cs == EDN_list_en_main) {} // silence ragel warning
|
2576
|
-
return
|
2598
|
+
return nullptr;
|
2577
2599
|
}
|
2578
2600
|
|
2579
2601
|
|
@@ -2582,7 +2604,7 @@ case 3:
|
|
2582
2604
|
// hash parsing
|
2583
2605
|
//
|
2584
2606
|
|
2585
|
-
#line
|
2607
|
+
#line 2608 "edn_parser.cc"
|
2586
2608
|
static const int EDN_map_start = 1;
|
2587
2609
|
static const int EDN_map_first_final = 4;
|
2588
2610
|
static const int EDN_map_error = 0;
|
@@ -2590,7 +2612,7 @@ static const int EDN_map_error = 0;
|
|
2590
2612
|
static const int EDN_map_en_main = 1;
|
2591
2613
|
|
2592
2614
|
|
2593
|
-
#line
|
2615
|
+
#line 747 "edn_parser.rl"
|
2594
2616
|
|
2595
2617
|
|
2596
2618
|
|
@@ -2604,14 +2626,14 @@ const char* edn::Parser::parse_map(const char *p, const char *pe, VALUE& v)
|
|
2604
2626
|
VALUE elems;
|
2605
2627
|
|
2606
2628
|
|
2607
|
-
#line
|
2629
|
+
#line 2630 "edn_parser.cc"
|
2608
2630
|
{
|
2609
2631
|
cs = EDN_map_start;
|
2610
2632
|
}
|
2611
2633
|
|
2612
|
-
#line
|
2634
|
+
#line 760 "edn_parser.rl"
|
2613
2635
|
|
2614
|
-
#line
|
2636
|
+
#line 2637 "edn_parser.cc"
|
2615
2637
|
{
|
2616
2638
|
if ( p == pe )
|
2617
2639
|
goto _test_eof;
|
@@ -2622,7 +2644,7 @@ case 1:
|
|
2622
2644
|
goto tr0;
|
2623
2645
|
goto st0;
|
2624
2646
|
tr2:
|
2625
|
-
#line
|
2647
|
+
#line 73 "edn_parser.rl"
|
2626
2648
|
{
|
2627
2649
|
std::stringstream s;
|
2628
2650
|
s << "unterminated " << EDN_TYPE;
|
@@ -2630,12 +2652,12 @@ tr2:
|
|
2630
2652
|
p--; {p++; cs = 0; goto _out;}
|
2631
2653
|
}
|
2632
2654
|
goto st0;
|
2633
|
-
#line
|
2655
|
+
#line 2656 "edn_parser.cc"
|
2634
2656
|
st0:
|
2635
2657
|
cs = 0;
|
2636
2658
|
goto _out;
|
2637
2659
|
tr0:
|
2638
|
-
#line
|
2660
|
+
#line 591 "edn_parser.rl"
|
2639
2661
|
{
|
2640
2662
|
// sequences store elements in an array, then process it to
|
2641
2663
|
// convert it to a list, set, or map as needed once the
|
@@ -2647,11 +2669,11 @@ tr0:
|
|
2647
2669
|
}
|
2648
2670
|
goto st2;
|
2649
2671
|
tr4:
|
2650
|
-
#line
|
2672
|
+
#line 47 "edn_parser.rl"
|
2651
2673
|
{ line_number++; }
|
2652
2674
|
goto st2;
|
2653
2675
|
tr5:
|
2654
|
-
#line
|
2676
|
+
#line 606 "edn_parser.rl"
|
2655
2677
|
{
|
2656
2678
|
// reads an item within a sequence (vector, list, map, or
|
2657
2679
|
// set). Regardless of the sequence type, an array of the
|
@@ -2660,7 +2682,7 @@ tr5:
|
|
2660
2682
|
VALUE e;
|
2661
2683
|
std::size_t meta_sz = meta_size();
|
2662
2684
|
const char *np = parse_value(p, pe, e);
|
2663
|
-
if (np ==
|
2685
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {
|
2664
2686
|
// if there's an entry in the discard list, the current
|
2665
2687
|
// object is not meant to be kept due to a #_ so don't
|
2666
2688
|
// push it into the list of elements
|
@@ -2689,7 +2711,7 @@ st2:
|
|
2689
2711
|
if ( ++p == pe )
|
2690
2712
|
goto _test_eof2;
|
2691
2713
|
case 2:
|
2692
|
-
#line
|
2714
|
+
#line 2715 "edn_parser.cc"
|
2693
2715
|
switch( (*p) ) {
|
2694
2716
|
case 10: goto tr4;
|
2695
2717
|
case 32: goto st2;
|
@@ -2723,19 +2745,19 @@ case 3:
|
|
2723
2745
|
goto tr4;
|
2724
2746
|
goto st3;
|
2725
2747
|
tr7:
|
2726
|
-
#line
|
2748
|
+
#line 601 "edn_parser.rl"
|
2727
2749
|
{
|
2728
2750
|
// remove the current metadata level
|
2729
2751
|
del_top_meta_list();
|
2730
2752
|
}
|
2731
|
-
#line
|
2753
|
+
#line 80 "edn_parser.rl"
|
2732
2754
|
{ p--; {p++; cs = 4; goto _out;} }
|
2733
2755
|
goto st4;
|
2734
2756
|
st4:
|
2735
2757
|
if ( ++p == pe )
|
2736
2758
|
goto _test_eof4;
|
2737
2759
|
case 4:
|
2738
|
-
#line
|
2760
|
+
#line 2761 "edn_parser.cc"
|
2739
2761
|
goto st0;
|
2740
2762
|
}
|
2741
2763
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -2748,7 +2770,7 @@ case 4:
|
|
2748
2770
|
switch ( cs ) {
|
2749
2771
|
case 2:
|
2750
2772
|
case 3:
|
2751
|
-
#line
|
2773
|
+
#line 73 "edn_parser.rl"
|
2752
2774
|
{
|
2753
2775
|
std::stringstream s;
|
2754
2776
|
s << "unterminated " << EDN_TYPE;
|
@@ -2756,14 +2778,14 @@ case 4:
|
|
2756
2778
|
p--; {p++; cs = 0; goto _out;}
|
2757
2779
|
}
|
2758
2780
|
break;
|
2759
|
-
#line
|
2781
|
+
#line 2782 "edn_parser.cc"
|
2760
2782
|
}
|
2761
2783
|
}
|
2762
2784
|
|
2763
2785
|
_out: {}
|
2764
2786
|
}
|
2765
2787
|
|
2766
|
-
#line
|
2788
|
+
#line 761 "edn_parser.rl"
|
2767
2789
|
|
2768
2790
|
if (cs >= EDN_map_first_final) {
|
2769
2791
|
|
@@ -2788,7 +2810,7 @@ case 4:
|
|
2788
2810
|
return pe;
|
2789
2811
|
}
|
2790
2812
|
else if (cs == EDN_map_en_main) {} // silence ragel warning
|
2791
|
-
return
|
2813
|
+
return nullptr;
|
2792
2814
|
}
|
2793
2815
|
|
2794
2816
|
|
@@ -2799,7 +2821,7 @@ case 4:
|
|
2799
2821
|
// the remaining data to the correct parser
|
2800
2822
|
//
|
2801
2823
|
|
2802
|
-
#line
|
2824
|
+
#line 2825 "edn_parser.cc"
|
2803
2825
|
static const int EDN_dispatch_start = 1;
|
2804
2826
|
static const int EDN_dispatch_first_final = 2;
|
2805
2827
|
static const int EDN_dispatch_error = 0;
|
@@ -2807,7 +2829,7 @@ static const int EDN_dispatch_error = 0;
|
|
2807
2829
|
static const int EDN_dispatch_en_main = 1;
|
2808
2830
|
|
2809
2831
|
|
2810
|
-
#line
|
2832
|
+
#line 825 "edn_parser.rl"
|
2811
2833
|
|
2812
2834
|
|
2813
2835
|
|
@@ -2816,14 +2838,14 @@ const char* edn::Parser::parse_dispatch(const char *p, const char *pe, VALUE& v)
|
|
2816
2838
|
int cs;
|
2817
2839
|
|
2818
2840
|
|
2819
|
-
#line
|
2841
|
+
#line 2842 "edn_parser.cc"
|
2820
2842
|
{
|
2821
2843
|
cs = EDN_dispatch_start;
|
2822
2844
|
}
|
2823
2845
|
|
2824
|
-
#line
|
2846
|
+
#line 833 "edn_parser.rl"
|
2825
2847
|
|
2826
|
-
#line
|
2848
|
+
#line 2849 "edn_parser.cc"
|
2827
2849
|
{
|
2828
2850
|
if ( p == pe )
|
2829
2851
|
goto _test_eof;
|
@@ -2844,40 +2866,40 @@ st0:
|
|
2844
2866
|
cs = 0;
|
2845
2867
|
goto _out;
|
2846
2868
|
tr0:
|
2847
|
-
#line
|
2869
|
+
#line 813 "edn_parser.rl"
|
2848
2870
|
{
|
2849
2871
|
// #inst, #uuid, or #user/tag
|
2850
2872
|
const char *np = parse_tagged(p, pe, v);
|
2851
|
-
if (np ==
|
2873
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
2852
2874
|
}
|
2853
|
-
#line
|
2875
|
+
#line 80 "edn_parser.rl"
|
2854
2876
|
{ p--; {p++; cs = 2; goto _out;} }
|
2855
2877
|
goto st2;
|
2856
2878
|
tr2:
|
2857
|
-
#line
|
2879
|
+
#line 807 "edn_parser.rl"
|
2858
2880
|
{
|
2859
2881
|
// discard token #_
|
2860
2882
|
const char *np = parse_discard(p, pe);
|
2861
|
-
if (np ==
|
2883
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
2862
2884
|
}
|
2863
|
-
#line
|
2885
|
+
#line 80 "edn_parser.rl"
|
2864
2886
|
{ p--; {p++; cs = 2; goto _out;} }
|
2865
2887
|
goto st2;
|
2866
2888
|
tr3:
|
2867
|
-
#line
|
2889
|
+
#line 801 "edn_parser.rl"
|
2868
2890
|
{
|
2869
2891
|
// #{ }
|
2870
2892
|
const char *np = parse_set(p, pe, v);
|
2871
|
-
if (np ==
|
2893
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {p = (( np))-1;}
|
2872
2894
|
}
|
2873
|
-
#line
|
2895
|
+
#line 80 "edn_parser.rl"
|
2874
2896
|
{ p--; {p++; cs = 2; goto _out;} }
|
2875
2897
|
goto st2;
|
2876
2898
|
st2:
|
2877
2899
|
if ( ++p == pe )
|
2878
2900
|
goto _test_eof2;
|
2879
2901
|
case 2:
|
2880
|
-
#line
|
2902
|
+
#line 2903 "edn_parser.cc"
|
2881
2903
|
goto st0;
|
2882
2904
|
}
|
2883
2905
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -2886,7 +2908,7 @@ case 2:
|
|
2886
2908
|
_out: {}
|
2887
2909
|
}
|
2888
2910
|
|
2889
|
-
#line
|
2911
|
+
#line 834 "edn_parser.rl"
|
2890
2912
|
|
2891
2913
|
if (cs >= EDN_dispatch_first_final) {
|
2892
2914
|
return p + 1;
|
@@ -2897,7 +2919,7 @@ case 2:
|
|
2897
2919
|
}
|
2898
2920
|
else if (cs == EDN_dispatch_en_main) {} // silence ragel warning
|
2899
2921
|
|
2900
|
-
return
|
2922
|
+
return nullptr;
|
2901
2923
|
}
|
2902
2924
|
|
2903
2925
|
|
@@ -2905,7 +2927,7 @@ case 2:
|
|
2905
2927
|
// set parsing machine
|
2906
2928
|
//
|
2907
2929
|
|
2908
|
-
#line
|
2930
|
+
#line 2931 "edn_parser.cc"
|
2909
2931
|
static const int EDN_set_start = 1;
|
2910
2932
|
static const int EDN_set_first_final = 4;
|
2911
2933
|
static const int EDN_set_error = 0;
|
@@ -2913,7 +2935,7 @@ static const int EDN_set_error = 0;
|
|
2913
2935
|
static const int EDN_set_en_main = 1;
|
2914
2936
|
|
2915
2937
|
|
2916
|
-
#line
|
2938
|
+
#line 863 "edn_parser.rl"
|
2917
2939
|
|
2918
2940
|
|
2919
2941
|
//
|
@@ -2927,14 +2949,14 @@ const char* edn::Parser::parse_set(const char *p, const char *pe, VALUE& v)
|
|
2927
2949
|
VALUE elems; // holds the set's elements as an array allocated in @open_seq
|
2928
2950
|
|
2929
2951
|
|
2930
|
-
#line
|
2952
|
+
#line 2953 "edn_parser.cc"
|
2931
2953
|
{
|
2932
2954
|
cs = EDN_set_start;
|
2933
2955
|
}
|
2934
2956
|
|
2935
|
-
#line
|
2957
|
+
#line 876 "edn_parser.rl"
|
2936
2958
|
|
2937
|
-
#line
|
2959
|
+
#line 2960 "edn_parser.cc"
|
2938
2960
|
{
|
2939
2961
|
if ( p == pe )
|
2940
2962
|
goto _test_eof;
|
@@ -2945,7 +2967,7 @@ case 1:
|
|
2945
2967
|
goto tr0;
|
2946
2968
|
goto st0;
|
2947
2969
|
tr2:
|
2948
|
-
#line
|
2970
|
+
#line 73 "edn_parser.rl"
|
2949
2971
|
{
|
2950
2972
|
std::stringstream s;
|
2951
2973
|
s << "unterminated " << EDN_TYPE;
|
@@ -2953,12 +2975,12 @@ tr2:
|
|
2953
2975
|
p--; {p++; cs = 0; goto _out;}
|
2954
2976
|
}
|
2955
2977
|
goto st0;
|
2956
|
-
#line
|
2978
|
+
#line 2979 "edn_parser.cc"
|
2957
2979
|
st0:
|
2958
2980
|
cs = 0;
|
2959
2981
|
goto _out;
|
2960
2982
|
tr0:
|
2961
|
-
#line
|
2983
|
+
#line 591 "edn_parser.rl"
|
2962
2984
|
{
|
2963
2985
|
// sequences store elements in an array, then process it to
|
2964
2986
|
// convert it to a list, set, or map as needed once the
|
@@ -2970,11 +2992,11 @@ tr0:
|
|
2970
2992
|
}
|
2971
2993
|
goto st2;
|
2972
2994
|
tr4:
|
2973
|
-
#line
|
2995
|
+
#line 47 "edn_parser.rl"
|
2974
2996
|
{ line_number++; }
|
2975
2997
|
goto st2;
|
2976
2998
|
tr5:
|
2977
|
-
#line
|
2999
|
+
#line 606 "edn_parser.rl"
|
2978
3000
|
{
|
2979
3001
|
// reads an item within a sequence (vector, list, map, or
|
2980
3002
|
// set). Regardless of the sequence type, an array of the
|
@@ -2983,7 +3005,7 @@ tr5:
|
|
2983
3005
|
VALUE e;
|
2984
3006
|
std::size_t meta_sz = meta_size();
|
2985
3007
|
const char *np = parse_value(p, pe, e);
|
2986
|
-
if (np ==
|
3008
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {
|
2987
3009
|
// if there's an entry in the discard list, the current
|
2988
3010
|
// object is not meant to be kept due to a #_ so don't
|
2989
3011
|
// push it into the list of elements
|
@@ -3012,7 +3034,7 @@ st2:
|
|
3012
3034
|
if ( ++p == pe )
|
3013
3035
|
goto _test_eof2;
|
3014
3036
|
case 2:
|
3015
|
-
#line
|
3037
|
+
#line 3038 "edn_parser.cc"
|
3016
3038
|
switch( (*p) ) {
|
3017
3039
|
case 10: goto tr4;
|
3018
3040
|
case 32: goto st2;
|
@@ -3046,19 +3068,19 @@ case 3:
|
|
3046
3068
|
goto tr4;
|
3047
3069
|
goto st3;
|
3048
3070
|
tr7:
|
3049
|
-
#line
|
3071
|
+
#line 601 "edn_parser.rl"
|
3050
3072
|
{
|
3051
3073
|
// remove the current metadata level
|
3052
3074
|
del_top_meta_list();
|
3053
3075
|
}
|
3054
|
-
#line
|
3076
|
+
#line 80 "edn_parser.rl"
|
3055
3077
|
{ p--; {p++; cs = 4; goto _out;} }
|
3056
3078
|
goto st4;
|
3057
3079
|
st4:
|
3058
3080
|
if ( ++p == pe )
|
3059
3081
|
goto _test_eof4;
|
3060
3082
|
case 4:
|
3061
|
-
#line
|
3083
|
+
#line 3084 "edn_parser.cc"
|
3062
3084
|
goto st0;
|
3063
3085
|
}
|
3064
3086
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -3071,7 +3093,7 @@ case 4:
|
|
3071
3093
|
switch ( cs ) {
|
3072
3094
|
case 2:
|
3073
3095
|
case 3:
|
3074
|
-
#line
|
3096
|
+
#line 73 "edn_parser.rl"
|
3075
3097
|
{
|
3076
3098
|
std::stringstream s;
|
3077
3099
|
s << "unterminated " << EDN_TYPE;
|
@@ -3079,14 +3101,14 @@ case 4:
|
|
3079
3101
|
p--; {p++; cs = 0; goto _out;}
|
3080
3102
|
}
|
3081
3103
|
break;
|
3082
|
-
#line
|
3104
|
+
#line 3105 "edn_parser.cc"
|
3083
3105
|
}
|
3084
3106
|
}
|
3085
3107
|
|
3086
3108
|
_out: {}
|
3087
3109
|
}
|
3088
3110
|
|
3089
|
-
#line
|
3111
|
+
#line 877 "edn_parser.rl"
|
3090
3112
|
|
3091
3113
|
if (cs >= EDN_set_first_final) {
|
3092
3114
|
// all elements collected; now convert to a set
|
@@ -3098,7 +3120,7 @@ case 4:
|
|
3098
3120
|
return pe;
|
3099
3121
|
}
|
3100
3122
|
else if (cs == EDN_set_en_main) {} // silence ragel warning
|
3101
|
-
return
|
3123
|
+
return nullptr;
|
3102
3124
|
}
|
3103
3125
|
|
3104
3126
|
|
@@ -3109,7 +3131,7 @@ case 4:
|
|
3109
3131
|
// defining a machine to consume items within container delimiters
|
3110
3132
|
//
|
3111
3133
|
|
3112
|
-
#line
|
3134
|
+
#line 3135 "edn_parser.cc"
|
3113
3135
|
static const int EDN_discard_start = 1;
|
3114
3136
|
static const int EDN_discard_first_final = 4;
|
3115
3137
|
static const int EDN_discard_error = 0;
|
@@ -3117,7 +3139,7 @@ static const int EDN_discard_error = 0;
|
|
3117
3139
|
static const int EDN_discard_en_main = 1;
|
3118
3140
|
|
3119
3141
|
|
3120
|
-
#line
|
3142
|
+
#line 927 "edn_parser.rl"
|
3121
3143
|
|
3122
3144
|
|
3123
3145
|
|
@@ -3127,14 +3149,14 @@ const char* edn::Parser::parse_discard(const char *p, const char *pe)
|
|
3127
3149
|
VALUE v;
|
3128
3150
|
|
3129
3151
|
|
3130
|
-
#line
|
3152
|
+
#line 3153 "edn_parser.cc"
|
3131
3153
|
{
|
3132
3154
|
cs = EDN_discard_start;
|
3133
3155
|
}
|
3134
3156
|
|
3135
|
-
#line
|
3157
|
+
#line 936 "edn_parser.rl"
|
3136
3158
|
|
3137
|
-
#line
|
3159
|
+
#line 3160 "edn_parser.cc"
|
3138
3160
|
{
|
3139
3161
|
if ( p == pe )
|
3140
3162
|
goto _test_eof;
|
@@ -3145,7 +3167,7 @@ case 1:
|
|
3145
3167
|
goto st2;
|
3146
3168
|
goto st0;
|
3147
3169
|
tr2:
|
3148
|
-
#line
|
3170
|
+
#line 917 "edn_parser.rl"
|
3149
3171
|
{
|
3150
3172
|
std::stringstream s;
|
3151
3173
|
s << "discard sequence without element to discard";
|
@@ -3153,19 +3175,19 @@ tr2:
|
|
3153
3175
|
p--; {p++; cs = 0; goto _out;}
|
3154
3176
|
}
|
3155
3177
|
goto st0;
|
3156
|
-
#line
|
3178
|
+
#line 3179 "edn_parser.cc"
|
3157
3179
|
st0:
|
3158
3180
|
cs = 0;
|
3159
3181
|
goto _out;
|
3160
3182
|
tr3:
|
3161
|
-
#line
|
3183
|
+
#line 47 "edn_parser.rl"
|
3162
3184
|
{ line_number++; }
|
3163
3185
|
goto st2;
|
3164
3186
|
st2:
|
3165
3187
|
if ( ++p == pe )
|
3166
3188
|
goto _test_eof2;
|
3167
3189
|
case 2:
|
3168
|
-
#line
|
3190
|
+
#line 3191 "edn_parser.cc"
|
3169
3191
|
switch( (*p) ) {
|
3170
3192
|
case 10: goto tr3;
|
3171
3193
|
case 32: goto st2;
|
@@ -3191,10 +3213,10 @@ case 2:
|
|
3191
3213
|
goto tr4;
|
3192
3214
|
goto tr2;
|
3193
3215
|
tr4:
|
3194
|
-
#line
|
3216
|
+
#line 906 "edn_parser.rl"
|
3195
3217
|
{
|
3196
3218
|
const char *np = parse_value(p, pe, v);
|
3197
|
-
if (np ==
|
3219
|
+
if (np == nullptr) { p--; {p++; cs = 4; goto _out;} } else {
|
3198
3220
|
// this token is to be discarded so store it in the
|
3199
3221
|
// discard stack - we really don't need to save it so this
|
3200
3222
|
// could be simplified
|
@@ -3202,14 +3224,14 @@ tr4:
|
|
3202
3224
|
{p = (( np))-1;}
|
3203
3225
|
}
|
3204
3226
|
}
|
3205
|
-
#line
|
3227
|
+
#line 80 "edn_parser.rl"
|
3206
3228
|
{ p--; {p++; cs = 4; goto _out;} }
|
3207
3229
|
goto st4;
|
3208
3230
|
st4:
|
3209
3231
|
if ( ++p == pe )
|
3210
3232
|
goto _test_eof4;
|
3211
3233
|
case 4:
|
3212
|
-
#line
|
3234
|
+
#line 3235 "edn_parser.cc"
|
3213
3235
|
goto st0;
|
3214
3236
|
st3:
|
3215
3237
|
if ( ++p == pe )
|
@@ -3228,7 +3250,7 @@ case 3:
|
|
3228
3250
|
{
|
3229
3251
|
switch ( cs ) {
|
3230
3252
|
case 2:
|
3231
|
-
#line
|
3253
|
+
#line 917 "edn_parser.rl"
|
3232
3254
|
{
|
3233
3255
|
std::stringstream s;
|
3234
3256
|
s << "discard sequence without element to discard";
|
@@ -3236,14 +3258,14 @@ case 3:
|
|
3236
3258
|
p--; {p++; cs = 0; goto _out;}
|
3237
3259
|
}
|
3238
3260
|
break;
|
3239
|
-
#line
|
3261
|
+
#line 3262 "edn_parser.cc"
|
3240
3262
|
}
|
3241
3263
|
}
|
3242
3264
|
|
3243
3265
|
_out: {}
|
3244
3266
|
}
|
3245
3267
|
|
3246
|
-
#line
|
3268
|
+
#line 937 "edn_parser.rl"
|
3247
3269
|
|
3248
3270
|
if (cs >= EDN_discard_first_final) {
|
3249
3271
|
return p + 1;
|
@@ -3254,7 +3276,7 @@ case 3:
|
|
3254
3276
|
}
|
3255
3277
|
else if (cs == EDN_discard_en_main) {} // silence ragel warning
|
3256
3278
|
|
3257
|
-
return
|
3279
|
+
return nullptr;
|
3258
3280
|
}
|
3259
3281
|
|
3260
3282
|
|
@@ -3274,7 +3296,7 @@ case 3:
|
|
3274
3296
|
// 2. add parse checks for uuid and inst for better error reporting
|
3275
3297
|
//
|
3276
3298
|
|
3277
|
-
#line
|
3299
|
+
#line 3300 "edn_parser.cc"
|
3278
3300
|
static const int EDN_tagged_start = 1;
|
3279
3301
|
static const int EDN_tagged_first_final = 7;
|
3280
3302
|
static const int EDN_tagged_error = 0;
|
@@ -3282,7 +3304,7 @@ static const int EDN_tagged_error = 0;
|
|
3282
3304
|
static const int EDN_tagged_en_main = 1;
|
3283
3305
|
|
3284
3306
|
|
3285
|
-
#line
|
3307
|
+
#line 1005 "edn_parser.rl"
|
3286
3308
|
|
3287
3309
|
|
3288
3310
|
|
@@ -3296,14 +3318,14 @@ const char* edn::Parser::parse_tagged(const char *p, const char *pe, VALUE& v)
|
|
3296
3318
|
int cs;
|
3297
3319
|
|
3298
3320
|
|
3299
|
-
#line
|
3321
|
+
#line 3322 "edn_parser.cc"
|
3300
3322
|
{
|
3301
3323
|
cs = EDN_tagged_start;
|
3302
3324
|
}
|
3303
3325
|
|
3304
|
-
#line
|
3326
|
+
#line 1018 "edn_parser.rl"
|
3305
3327
|
|
3306
|
-
#line
|
3328
|
+
#line 3329 "edn_parser.cc"
|
3307
3329
|
{
|
3308
3330
|
if ( p == pe )
|
3309
3331
|
goto _test_eof;
|
@@ -3320,11 +3342,11 @@ st0:
|
|
3320
3342
|
cs = 0;
|
3321
3343
|
goto _out;
|
3322
3344
|
tr0:
|
3323
|
-
#line
|
3345
|
+
#line 984 "edn_parser.rl"
|
3324
3346
|
{
|
3325
3347
|
// parses the symbol portion of the pair
|
3326
3348
|
const char *np = parse_symbol(p, pe, sym_name);
|
3327
|
-
if (np ==
|
3349
|
+
if (np == nullptr) { p--; {p++; cs = 2; goto _out;} } else {
|
3328
3350
|
sym_ok = true;
|
3329
3351
|
{p = (( np))-1;}
|
3330
3352
|
}
|
@@ -3334,7 +3356,7 @@ st2:
|
|
3334
3356
|
if ( ++p == pe )
|
3335
3357
|
goto _test_eof2;
|
3336
3358
|
case 2:
|
3337
|
-
#line
|
3359
|
+
#line 3360 "edn_parser.cc"
|
3338
3360
|
switch( (*p) ) {
|
3339
3361
|
case 10: goto tr3;
|
3340
3362
|
case 32: goto st3;
|
@@ -3360,14 +3382,14 @@ case 2:
|
|
3360
3382
|
goto st2;
|
3361
3383
|
goto st0;
|
3362
3384
|
tr3:
|
3363
|
-
#line
|
3385
|
+
#line 47 "edn_parser.rl"
|
3364
3386
|
{ line_number++; }
|
3365
3387
|
goto st3;
|
3366
3388
|
st3:
|
3367
3389
|
if ( ++p == pe )
|
3368
3390
|
goto _test_eof3;
|
3369
3391
|
case 3:
|
3370
|
-
#line
|
3392
|
+
#line 3393 "edn_parser.cc"
|
3371
3393
|
switch( (*p) ) {
|
3372
3394
|
case 10: goto tr3;
|
3373
3395
|
case 32: goto st3;
|
@@ -3393,23 +3415,23 @@ case 3:
|
|
3393
3415
|
goto tr7;
|
3394
3416
|
goto st0;
|
3395
3417
|
tr7:
|
3396
|
-
#line
|
3418
|
+
#line 992 "edn_parser.rl"
|
3397
3419
|
{
|
3398
3420
|
// parses the value portion
|
3399
3421
|
const char *np = parse_value(p, pe, data);
|
3400
|
-
if (np ==
|
3422
|
+
if (np == nullptr) { p--; {p++; cs = 7; goto _out;} } else {
|
3401
3423
|
data_ok = true;
|
3402
3424
|
{p = (( np))-1;}
|
3403
3425
|
}
|
3404
3426
|
}
|
3405
|
-
#line
|
3427
|
+
#line 80 "edn_parser.rl"
|
3406
3428
|
{ p--; {p++; cs = 7; goto _out;} }
|
3407
3429
|
goto st7;
|
3408
3430
|
st7:
|
3409
3431
|
if ( ++p == pe )
|
3410
3432
|
goto _test_eof7;
|
3411
3433
|
case 7:
|
3412
|
-
#line
|
3434
|
+
#line 3435 "edn_parser.cc"
|
3413
3435
|
goto st0;
|
3414
3436
|
st4:
|
3415
3437
|
if ( ++p == pe )
|
@@ -3487,7 +3509,7 @@ case 6:
|
|
3487
3509
|
_out: {}
|
3488
3510
|
}
|
3489
3511
|
|
3490
|
-
#line
|
3512
|
+
#line 1019 "edn_parser.rl"
|
3491
3513
|
|
3492
3514
|
if (cs >= EDN_tagged_first_final) {
|
3493
3515
|
//std::cerr << __FUNCTION__ << " parse symbol name as '" << sym_name << "', value is: " << data << std::endl;
|
@@ -3495,7 +3517,7 @@ case 6:
|
|
3495
3517
|
if (!sym_ok || !data_ok) {
|
3496
3518
|
error(__FUNCTION__, "tagged element symbol error", *p);
|
3497
3519
|
v = EDN_EOF_CONST;
|
3498
|
-
return
|
3520
|
+
return nullptr;
|
3499
3521
|
}
|
3500
3522
|
|
3501
3523
|
try {
|
@@ -3513,7 +3535,7 @@ case 6:
|
|
3513
3535
|
}
|
3514
3536
|
else if (cs == EDN_tagged_en_main) {} // silence ragel warning
|
3515
3537
|
v = EDN_EOF_CONST;
|
3516
|
-
return
|
3538
|
+
return nullptr;
|
3517
3539
|
}
|
3518
3540
|
|
3519
3541
|
|
@@ -3525,7 +3547,7 @@ case 6:
|
|
3525
3547
|
// useful?
|
3526
3548
|
//
|
3527
3549
|
|
3528
|
-
#line
|
3550
|
+
#line 3551 "edn_parser.cc"
|
3529
3551
|
static const int EDN_meta_start = 1;
|
3530
3552
|
static const int EDN_meta_first_final = 3;
|
3531
3553
|
static const int EDN_meta_error = 0;
|
@@ -3533,7 +3555,7 @@ static const int EDN_meta_error = 0;
|
|
3533
3555
|
static const int EDN_meta_en_main = 1;
|
3534
3556
|
|
3535
3557
|
|
3536
|
-
#line
|
3558
|
+
#line 1069 "edn_parser.rl"
|
3537
3559
|
|
3538
3560
|
|
3539
3561
|
|
@@ -3543,14 +3565,14 @@ const char* edn::Parser::parse_meta(const char *p, const char *pe)
|
|
3543
3565
|
VALUE v;
|
3544
3566
|
|
3545
3567
|
|
3546
|
-
#line
|
3568
|
+
#line 3569 "edn_parser.cc"
|
3547
3569
|
{
|
3548
3570
|
cs = EDN_meta_start;
|
3549
3571
|
}
|
3550
3572
|
|
3551
|
-
#line
|
3573
|
+
#line 1078 "edn_parser.rl"
|
3552
3574
|
|
3553
|
-
#line
|
3575
|
+
#line 3576 "edn_parser.cc"
|
3554
3576
|
{
|
3555
3577
|
if ( p == pe )
|
3556
3578
|
goto _test_eof;
|
@@ -3589,19 +3611,19 @@ case 2:
|
|
3589
3611
|
goto tr2;
|
3590
3612
|
goto st0;
|
3591
3613
|
tr2:
|
3592
|
-
#line
|
3614
|
+
#line 1061 "edn_parser.rl"
|
3593
3615
|
{
|
3594
3616
|
const char *np = parse_value(p, pe, v);
|
3595
|
-
if (np ==
|
3617
|
+
if (np == nullptr) { p--; {p++; cs = 3; goto _out;} } else { {p = (( np))-1;} }
|
3596
3618
|
}
|
3597
|
-
#line
|
3619
|
+
#line 80 "edn_parser.rl"
|
3598
3620
|
{ p--; {p++; cs = 3; goto _out;} }
|
3599
3621
|
goto st3;
|
3600
3622
|
st3:
|
3601
3623
|
if ( ++p == pe )
|
3602
3624
|
goto _test_eof3;
|
3603
3625
|
case 3:
|
3604
|
-
#line
|
3626
|
+
#line 3627 "edn_parser.cc"
|
3605
3627
|
goto st0;
|
3606
3628
|
}
|
3607
3629
|
_test_eof2: cs = 2; goto _test_eof;
|
@@ -3611,7 +3633,7 @@ case 3:
|
|
3611
3633
|
_out: {}
|
3612
3634
|
}
|
3613
3635
|
|
3614
|
-
#line
|
3636
|
+
#line 1079 "edn_parser.rl"
|
3615
3637
|
|
3616
3638
|
if (cs >= EDN_meta_first_final) {
|
3617
3639
|
append_to_meta(v);
|
@@ -3623,7 +3645,7 @@ case 3:
|
|
3623
3645
|
}
|
3624
3646
|
else if (cs == EDN_meta_en_main) {} // silence ragel warning
|
3625
3647
|
|
3626
|
-
return
|
3648
|
+
return nullptr;
|
3627
3649
|
}
|
3628
3650
|
|
3629
3651
|
|
@@ -3633,7 +3655,7 @@ case 3:
|
|
3633
3655
|
// top-level, therefore, does not tokenize source stream
|
3634
3656
|
//
|
3635
3657
|
|
3636
|
-
#line
|
3658
|
+
#line 3659 "edn_parser.cc"
|
3637
3659
|
static const int EDN_parser_start = 2;
|
3638
3660
|
static const int EDN_parser_first_final = 2;
|
3639
3661
|
static const int EDN_parser_error = 0;
|
@@ -3641,7 +3663,7 @@ static const int EDN_parser_error = 0;
|
|
3641
3663
|
static const int EDN_parser_en_main = 2;
|
3642
3664
|
|
3643
3665
|
|
3644
|
-
#line
|
3666
|
+
#line 1128 "edn_parser.rl"
|
3645
3667
|
|
3646
3668
|
|
3647
3669
|
|
@@ -3651,33 +3673,33 @@ VALUE edn::Parser::parse(const char* src, std::size_t len)
|
|
3651
3673
|
VALUE result = EDN_EOF_CONST;
|
3652
3674
|
|
3653
3675
|
|
3654
|
-
#line
|
3676
|
+
#line 3677 "edn_parser.cc"
|
3655
3677
|
{
|
3656
3678
|
cs = EDN_parser_start;
|
3657
3679
|
}
|
3658
3680
|
|
3659
|
-
#line
|
3681
|
+
#line 1137 "edn_parser.rl"
|
3660
3682
|
set_source(src, len);
|
3661
3683
|
|
3662
|
-
#line
|
3684
|
+
#line 3685 "edn_parser.cc"
|
3663
3685
|
{
|
3664
3686
|
if ( p == pe )
|
3665
3687
|
goto _test_eof;
|
3666
3688
|
switch ( cs )
|
3667
3689
|
{
|
3668
3690
|
tr1:
|
3669
|
-
#line
|
3691
|
+
#line 47 "edn_parser.rl"
|
3670
3692
|
{ line_number++; }
|
3671
3693
|
goto st2;
|
3672
3694
|
tr4:
|
3673
|
-
#line
|
3695
|
+
#line 1105 "edn_parser.rl"
|
3674
3696
|
{
|
3675
3697
|
// save the count of metadata items before we parse this value
|
3676
3698
|
// so we can determine if we've read another metadata value or
|
3677
3699
|
// an actual data item
|
3678
3700
|
std::size_t meta_sz = meta_size();
|
3679
3701
|
const char* np = parse_value(p, pe, result);
|
3680
|
-
if (np ==
|
3702
|
+
if (np == nullptr) { {p = (( pe))-1;} {p++; cs = 2; goto _out;} } else {
|
3681
3703
|
// if we have metadata saved and it matches the count we
|
3682
3704
|
// saved before we parsed a value, then we must bind the
|
3683
3705
|
// metadata sequence to it
|
@@ -3693,7 +3715,7 @@ st2:
|
|
3693
3715
|
if ( ++p == pe )
|
3694
3716
|
goto _test_eof2;
|
3695
3717
|
case 2:
|
3696
|
-
#line
|
3718
|
+
#line 3719 "edn_parser.cc"
|
3697
3719
|
switch( (*p) ) {
|
3698
3720
|
case 10: goto tr1;
|
3699
3721
|
case 32: goto st2;
|
@@ -3736,14 +3758,14 @@ case 1:
|
|
3736
3758
|
_out: {}
|
3737
3759
|
}
|
3738
3760
|
|
3739
|
-
#line
|
3761
|
+
#line 1139 "edn_parser.rl"
|
3740
3762
|
|
3741
3763
|
if (cs == EDN_parser_error) {
|
3742
3764
|
error(__FUNCTION__, *p);
|
3743
3765
|
return EDN_EOF_CONST;
|
3744
3766
|
}
|
3745
3767
|
else if (cs == EDN_parser_first_final) {
|
3746
|
-
p = pe = eof =
|
3768
|
+
p = pe = eof = nullptr;
|
3747
3769
|
}
|
3748
3770
|
else if (cs == EDN_parser_en_main) {} // silence ragel warning
|
3749
3771
|
return result;
|
@@ -3754,13 +3776,13 @@ case 1:
|
|
3754
3776
|
// token-by-token machine
|
3755
3777
|
//
|
3756
3778
|
|
3757
|
-
#line
|
3779
|
+
#line 3780 "edn_parser.cc"
|
3758
3780
|
static const int EDN_tokens_start = 1;
|
3759
3781
|
|
3760
3782
|
static const int EDN_tokens_en_main = 1;
|
3761
3783
|
|
3762
3784
|
|
3763
|
-
#line
|
3785
|
+
#line 1193 "edn_parser.rl"
|
3764
3786
|
|
3765
3787
|
|
3766
3788
|
|
@@ -3779,28 +3801,28 @@ edn::Parser::eTokenState edn::Parser::parse_next(VALUE& value)
|
|
3779
3801
|
discard.clear();
|
3780
3802
|
|
3781
3803
|
|
3782
|
-
#line
|
3804
|
+
#line 3805 "edn_parser.cc"
|
3783
3805
|
{
|
3784
3806
|
cs = EDN_tokens_start;
|
3785
3807
|
}
|
3786
3808
|
|
3787
|
-
#line
|
3809
|
+
#line 1211 "edn_parser.rl"
|
3788
3810
|
|
3789
|
-
#line
|
3811
|
+
#line 3812 "edn_parser.cc"
|
3790
3812
|
{
|
3791
3813
|
if ( p == pe )
|
3792
3814
|
goto _test_eof;
|
3793
3815
|
switch ( cs )
|
3794
3816
|
{
|
3795
3817
|
tr2:
|
3796
|
-
#line
|
3818
|
+
#line 47 "edn_parser.rl"
|
3797
3819
|
{ line_number++; }
|
3798
3820
|
goto st1;
|
3799
3821
|
st1:
|
3800
3822
|
if ( ++p == pe )
|
3801
3823
|
goto _test_eof1;
|
3802
3824
|
case 1:
|
3803
|
-
#line
|
3825
|
+
#line 3826 "edn_parser.cc"
|
3804
3826
|
switch( (*p) ) {
|
3805
3827
|
case 10: goto tr2;
|
3806
3828
|
case 32: goto st1;
|
@@ -3829,11 +3851,11 @@ st0:
|
|
3829
3851
|
cs = 0;
|
3830
3852
|
goto _out;
|
3831
3853
|
tr6:
|
3832
|
-
#line
|
3854
|
+
#line 47 "edn_parser.rl"
|
3833
3855
|
{ line_number++; }
|
3834
3856
|
goto st4;
|
3835
3857
|
tr3:
|
3836
|
-
#line
|
3858
|
+
#line 1161 "edn_parser.rl"
|
3837
3859
|
{
|
3838
3860
|
// we won't know if we've parsed a discard or a metadata until
|
3839
3861
|
// after parse_value() is done. Save the current number of
|
@@ -3842,7 +3864,7 @@ tr3:
|
|
3842
3864
|
meta_sz = meta_size();
|
3843
3865
|
|
3844
3866
|
const char* np = parse_value(p, pe, value);
|
3845
|
-
if (np ==
|
3867
|
+
if (np == nullptr) { p--; {p++; cs = 4; goto _out;} } else {
|
3846
3868
|
if (!meta_empty()) {
|
3847
3869
|
// was an additional metadata entry read? if so, don't
|
3848
3870
|
// return a value
|
@@ -3869,7 +3891,7 @@ st4:
|
|
3869
3891
|
if ( ++p == pe )
|
3870
3892
|
goto _test_eof4;
|
3871
3893
|
case 4:
|
3872
|
-
#line
|
3894
|
+
#line 3895 "edn_parser.cc"
|
3873
3895
|
switch( (*p) ) {
|
3874
3896
|
case 10: goto tr6;
|
3875
3897
|
case 32: goto st4;
|
@@ -3903,7 +3925,7 @@ case 3:
|
|
3903
3925
|
_out: {}
|
3904
3926
|
}
|
3905
3927
|
|
3906
|
-
#line
|
3928
|
+
#line 1212 "edn_parser.rl"
|
3907
3929
|
|
3908
3930
|
if (cs == EDN_tokens_en_main) {} // silence ragel warning
|
3909
3931
|
return state;
|