yaparc 0.3.0 → 0.4.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 +4 -4
- data/.envrc +1 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +1 -1
- data/README +6 -6
- data/Rakefile +12 -6
- data/TODO +11 -0
- data/lib/yaparc/abstract_parser.rb +16 -0
- data/lib/yaparc/alt.rb +22 -0
- data/lib/yaparc/apply.rb +18 -0
- data/lib/yaparc/char.rb +16 -0
- data/lib/yaparc/cr.rb +11 -0
- data/lib/yaparc/digit.rb +11 -0
- data/lib/yaparc/fail_parser.rb +11 -0
- data/lib/yaparc/ident.rb +18 -0
- data/lib/yaparc/identifier.rb +32 -0
- data/lib/yaparc/item.rb +17 -0
- data/lib/yaparc/literal.rb +13 -0
- data/lib/yaparc/many.rb +14 -0
- data/lib/yaparc/many_one.rb +27 -0
- data/lib/yaparc/nat.rb +11 -0
- data/lib/yaparc/natural.rb +12 -0
- data/lib/yaparc/no_fail.rb +20 -0
- data/lib/yaparc/parsable.rb +20 -0
- data/lib/yaparc/regex.rb +22 -0
- data/lib/yaparc/satisfy.rb +28 -0
- data/lib/yaparc/seq.rb +33 -0
- data/lib/yaparc/space.rb +11 -0
- data/lib/yaparc/string.rb +24 -0
- data/lib/yaparc/succeed.rb +14 -0
- data/lib/yaparc/symbol.rb +11 -0
- data/lib/yaparc/tokenize.rb +18 -0
- data/lib/yaparc/white_space.rb +11 -0
- data/lib/yaparc/zero_one.rb +20 -0
- data/lib/yaparc.rb +38 -608
- data/sig/yaparc.gen.rbs +89 -92
- data/yaparc.gemspec +17 -17
- metadata +32 -8
- data/manifest.scm +0 -1
data/sig/yaparc.gen.rbs
CHANGED
|
@@ -1,219 +1,216 @@
|
|
|
1
1
|
# TypeProf 0.21.3
|
|
2
2
|
|
|
3
3
|
# Classes
|
|
4
|
+
class Object
|
|
5
|
+
@parser: bot
|
|
6
|
+
end
|
|
7
|
+
|
|
4
8
|
module Yaparc
|
|
5
9
|
VERSION: String
|
|
10
|
+
OK: Class
|
|
11
|
+
Fail: Class
|
|
12
|
+
Error: Class
|
|
13
|
+
@input: untyped
|
|
14
|
+
@value: nil
|
|
6
15
|
|
|
7
|
-
|
|
8
|
-
class Base
|
|
9
|
-
attr_accessor message: nil
|
|
10
|
-
attr_accessor input: nil
|
|
11
|
-
attr_accessor value: nil
|
|
12
|
-
def initialize: (?Hash[untyped, untyped] options) -> void
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
class OK < Base
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
class Fail < Base
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
class Error < Base
|
|
22
|
-
end
|
|
23
|
-
end
|
|
16
|
+
def initialize: (input: untyped, ?value: nil) -> void
|
|
24
17
|
|
|
25
18
|
module Parsable
|
|
26
|
-
IS_LOWER:
|
|
27
|
-
IS_ALPHANUM:
|
|
28
|
-
IS_DIGIT:
|
|
29
|
-
IS_SPACE:
|
|
30
|
-
IS_WHITESPACE:
|
|
31
|
-
IS_CR:
|
|
19
|
+
IS_LOWER: ^(untyped) -> untyped
|
|
20
|
+
IS_ALPHANUM: ^(untyped) -> untyped
|
|
21
|
+
IS_DIGIT: ^(untyped) -> untyped
|
|
22
|
+
IS_SPACE: ^(untyped) -> untyped
|
|
23
|
+
IS_WHITESPACE: ^(untyped) -> bool
|
|
24
|
+
IS_CR: ^(untyped) -> untyped
|
|
32
25
|
@parser: bot
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
def parse: (nil input) -> untyped
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
class Succeed
|
|
39
|
-
include Parsable
|
|
40
|
-
@parser: Proc
|
|
41
|
-
|
|
42
|
-
attr_reader remaining: nil
|
|
43
|
-
def initialize: (untyped value, ?nil remaining) -> void
|
|
27
|
+
def parse: (nil input) -> (Alt | Regex | Satisfy)
|
|
44
28
|
end
|
|
45
29
|
|
|
46
|
-
class
|
|
30
|
+
class Alt
|
|
47
31
|
include Parsable
|
|
48
32
|
@parser: Proc
|
|
49
33
|
|
|
50
|
-
def initialize: -> void
|
|
34
|
+
def initialize: (*ManyOne | Succeed parsers) -> void
|
|
51
35
|
end
|
|
52
36
|
|
|
53
|
-
class
|
|
37
|
+
class Apply
|
|
54
38
|
include Parsable
|
|
55
39
|
@parser: Proc
|
|
56
40
|
|
|
57
|
-
def initialize: -> void
|
|
41
|
+
def initialize: (untyped parser) -> void
|
|
58
42
|
end
|
|
59
43
|
|
|
60
|
-
class
|
|
44
|
+
class Char
|
|
61
45
|
include Parsable
|
|
62
|
-
@parser:
|
|
46
|
+
@parser: ^-> Satisfy
|
|
63
47
|
|
|
64
|
-
def initialize: (untyped
|
|
48
|
+
def initialize: (untyped char, ?true case_sensitive) -> void
|
|
65
49
|
end
|
|
66
50
|
|
|
67
|
-
class
|
|
51
|
+
class CR
|
|
68
52
|
include Parsable
|
|
69
|
-
@parser:
|
|
53
|
+
@parser: ^-> Regex
|
|
70
54
|
|
|
71
|
-
def initialize:
|
|
72
|
-
def parse: (untyped input) -> untyped
|
|
55
|
+
def initialize: -> void
|
|
73
56
|
end
|
|
74
57
|
|
|
75
|
-
class
|
|
58
|
+
class Digit
|
|
76
59
|
include Parsable
|
|
77
|
-
@parser:
|
|
60
|
+
@parser: ^-> Satisfy
|
|
78
61
|
|
|
79
|
-
def initialize:
|
|
62
|
+
def initialize: -> void
|
|
80
63
|
end
|
|
81
64
|
|
|
82
|
-
class
|
|
65
|
+
class FailParser
|
|
83
66
|
include Parsable
|
|
84
|
-
@parser:
|
|
67
|
+
@parser: ^(nil) -> untyped
|
|
85
68
|
|
|
86
|
-
def initialize:
|
|
69
|
+
def initialize: -> void
|
|
87
70
|
end
|
|
88
71
|
|
|
89
|
-
class
|
|
72
|
+
class Ident
|
|
90
73
|
include Parsable
|
|
91
|
-
@parser:
|
|
74
|
+
@parser: ^-> Seq
|
|
92
75
|
|
|
93
|
-
def initialize:
|
|
76
|
+
def initialize: -> void
|
|
94
77
|
end
|
|
95
78
|
|
|
96
|
-
class
|
|
79
|
+
class Identifier
|
|
80
|
+
IDENTIFIER_REGEX: Regexp
|
|
97
81
|
include Parsable
|
|
98
|
-
@parser: Proc
|
|
82
|
+
@parser: Proc | ^-> Tokenize
|
|
99
83
|
|
|
100
|
-
def initialize: (
|
|
84
|
+
def initialize: (?regex: nil, ?exclude: nil) -> void
|
|
101
85
|
end
|
|
102
86
|
|
|
103
|
-
class
|
|
87
|
+
class Item
|
|
104
88
|
include Parsable
|
|
105
89
|
@parser: Proc
|
|
106
90
|
|
|
107
|
-
def initialize:
|
|
91
|
+
def initialize: -> void
|
|
108
92
|
end
|
|
109
93
|
|
|
110
|
-
class
|
|
94
|
+
class Literal
|
|
111
95
|
include Parsable
|
|
112
|
-
@
|
|
113
|
-
@parser: Proc
|
|
96
|
+
@parser: ^-> Tokenize
|
|
114
97
|
|
|
115
|
-
def initialize: (
|
|
98
|
+
def initialize: (untyped literal, ?true case_sensitive) -> void
|
|
116
99
|
end
|
|
117
100
|
|
|
118
101
|
class Many
|
|
119
102
|
include Parsable
|
|
103
|
+
@parser: ^-> Alt
|
|
120
104
|
|
|
121
105
|
def initialize: (Satisfy parser, ?Array[untyped] | String identity) -> void
|
|
122
106
|
end
|
|
123
107
|
|
|
124
108
|
class ManyOne
|
|
125
109
|
include Parsable
|
|
110
|
+
@parser: Proc
|
|
126
111
|
|
|
127
112
|
def initialize: (Digit parser, ?Array[untyped] | String identity) -> void
|
|
128
113
|
end
|
|
129
114
|
|
|
130
|
-
class
|
|
115
|
+
class Nat
|
|
131
116
|
include Parsable
|
|
132
|
-
@parser:
|
|
117
|
+
@parser: ^-> Seq
|
|
133
118
|
|
|
134
119
|
def initialize: -> void
|
|
135
120
|
end
|
|
136
121
|
|
|
137
|
-
class
|
|
122
|
+
class Natural
|
|
138
123
|
include Parsable
|
|
139
|
-
@parser:
|
|
124
|
+
@parser: ^-> Tokenize
|
|
140
125
|
|
|
141
|
-
def initialize: -> void
|
|
126
|
+
def initialize: (**untyped) -> void
|
|
142
127
|
end
|
|
143
128
|
|
|
144
|
-
class
|
|
129
|
+
class NoFail
|
|
145
130
|
include Parsable
|
|
146
131
|
@parser: Proc
|
|
147
132
|
|
|
148
|
-
def initialize: -> void
|
|
133
|
+
def initialize: (untyped parser) -> void
|
|
149
134
|
end
|
|
150
135
|
|
|
151
|
-
class
|
|
136
|
+
class Regex
|
|
152
137
|
include Parsable
|
|
138
|
+
@regex: Regexp
|
|
153
139
|
@parser: Proc
|
|
154
140
|
|
|
155
|
-
|
|
156
|
-
attr_accessor postfix: WhiteSpace
|
|
157
|
-
def initialize: (Regex | String parser, ?Hash[untyped, untyped] args) -> void
|
|
141
|
+
def initialize: (Regexp regex) -> void
|
|
158
142
|
end
|
|
159
143
|
|
|
160
|
-
class
|
|
144
|
+
class Satisfy
|
|
161
145
|
include Parsable
|
|
162
146
|
@parser: Proc
|
|
163
147
|
|
|
164
|
-
def initialize: (untyped
|
|
148
|
+
def initialize: (^(untyped) -> untyped predicate) -> void
|
|
149
|
+
def parse: (nil input) -> untyped
|
|
165
150
|
end
|
|
166
151
|
|
|
167
|
-
class
|
|
168
|
-
IDENTIFIER_REGEX: Regexp
|
|
152
|
+
class Seq
|
|
169
153
|
include Parsable
|
|
170
154
|
@parser: Proc
|
|
171
155
|
|
|
172
|
-
def initialize: (
|
|
156
|
+
def initialize: (*Char | Many | ManyOne | Regex | Satisfy | String | Succeed | WhiteSpace parsers) { (*untyped) -> Array[untyped] } -> void
|
|
173
157
|
end
|
|
174
158
|
|
|
175
|
-
class
|
|
159
|
+
class Space
|
|
160
|
+
include Parsable
|
|
161
|
+
@parser: ^-> Regex
|
|
162
|
+
|
|
163
|
+
def initialize: -> void
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
class String
|
|
176
167
|
include Parsable
|
|
177
168
|
@parser: Proc
|
|
178
169
|
|
|
179
|
-
def initialize: (untyped
|
|
170
|
+
def initialize: (untyped string, ?true case_sensitive) -> void
|
|
180
171
|
end
|
|
181
172
|
|
|
182
|
-
class
|
|
173
|
+
class Succeed
|
|
183
174
|
include Parsable
|
|
175
|
+
@parser: ^(nil) -> untyped
|
|
184
176
|
|
|
185
|
-
|
|
177
|
+
attr_reader remaining: nil
|
|
178
|
+
def initialize: (Alt | Array[untyped] | Regex | Satisfy value, ?nil remaining) -> void
|
|
186
179
|
end
|
|
187
180
|
|
|
188
|
-
class
|
|
181
|
+
class Symbol
|
|
189
182
|
include Parsable
|
|
190
|
-
@parser:
|
|
183
|
+
@parser: ^-> Literal
|
|
191
184
|
|
|
192
|
-
def initialize: -> void
|
|
185
|
+
def initialize: (untyped literal) -> void
|
|
193
186
|
end
|
|
194
187
|
|
|
195
|
-
class
|
|
188
|
+
class Tokenize
|
|
196
189
|
include Parsable
|
|
190
|
+
@parser: Proc
|
|
197
191
|
|
|
198
|
-
|
|
192
|
+
attr_writer prefix: WhiteSpace
|
|
193
|
+
attr_writer postfix: WhiteSpace
|
|
194
|
+
def initialize: (Regex | String parser, ?prefix: nil, ?postfix: nil) -> void
|
|
199
195
|
end
|
|
200
196
|
|
|
201
|
-
class
|
|
197
|
+
class WhiteSpace
|
|
202
198
|
include Parsable
|
|
199
|
+
@parser: ^-> Regex
|
|
203
200
|
|
|
204
|
-
def initialize:
|
|
201
|
+
def initialize: -> void
|
|
205
202
|
end
|
|
206
203
|
|
|
207
|
-
class
|
|
204
|
+
class ZeroOne
|
|
208
205
|
include Parsable
|
|
209
206
|
@parser: Proc
|
|
210
207
|
|
|
211
|
-
def initialize: (untyped
|
|
208
|
+
def initialize: (untyped parser, ?Array[untyped] identity) -> void
|
|
212
209
|
end
|
|
213
210
|
|
|
214
211
|
class AbstractParser
|
|
215
212
|
include Parsable
|
|
216
|
-
@
|
|
213
|
+
@tree: untyped
|
|
217
214
|
|
|
218
215
|
def parse: (untyped input) -> untyped
|
|
219
216
|
end
|
data/yaparc.gemspec
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
3
|
+
require_relative 'lib/yaparc'
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name =
|
|
6
|
+
spec.name = 'yaparc'
|
|
7
7
|
spec.version = Yaparc::VERSION
|
|
8
|
-
spec.authors = [
|
|
9
|
-
spec.email = [
|
|
8
|
+
spec.authors = ['Akimichi Tatsukawa', 'gemmaro']
|
|
9
|
+
spec.email = ['akimichi.tatsukawa@gmail.com', 'gemmaro.dev@gmail.com']
|
|
10
10
|
|
|
11
|
-
spec.summary =
|
|
12
|
-
spec.homepage = homepage =
|
|
13
|
-
spec.required_ruby_version =
|
|
11
|
+
spec.summary = 'Yet another simple parser combinator library'
|
|
12
|
+
spec.homepage = homepage = 'https://git.disroot.org/gemmaro/yaparc'
|
|
13
|
+
spec.required_ruby_version = '>= 3.1.6'
|
|
14
14
|
|
|
15
15
|
spec.files = Dir.chdir(__dir__) do
|
|
16
16
|
`git ls-files -z`.split("\x0").reject do |f|
|
|
@@ -18,19 +18,19 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
spec.require_paths = [
|
|
21
|
+
spec.require_paths = ['lib']
|
|
22
22
|
|
|
23
|
-
spec.add_development_dependency
|
|
24
|
-
spec.add_development_dependency
|
|
25
|
-
spec.add_development_dependency
|
|
23
|
+
spec.add_development_dependency 'rake'
|
|
24
|
+
spec.add_development_dependency 'rubocop'
|
|
25
|
+
spec.add_development_dependency 'test-unit'
|
|
26
26
|
|
|
27
27
|
spec.metadata = {
|
|
28
28
|
'rubygems_mfa_required' => 'true',
|
|
29
|
-
'bug_tracker_uri'
|
|
30
|
-
'changelog_uri'
|
|
31
|
-
'documentation_uri'
|
|
32
|
-
'homepage_uri'
|
|
33
|
-
'source_code_uri'
|
|
34
|
-
'wiki_uri'
|
|
29
|
+
'bug_tracker_uri' => "#{homepage}/issues",
|
|
30
|
+
'changelog_uri' => "#{homepage}/src/branch/main/CHANGELOG.md",
|
|
31
|
+
'documentation_uri' => 'https://rubydoc.info/gems/yaparc',
|
|
32
|
+
'homepage_uri' => homepage,
|
|
33
|
+
'source_code_uri' => homepage,
|
|
34
|
+
'wiki_uri' => "#{homepage}/wiki"
|
|
35
35
|
}
|
|
36
36
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yaparc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Akimichi Tatsukawa
|
|
8
8
|
- gemmaro
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: rake
|
|
@@ -53,7 +52,6 @@ dependencies:
|
|
|
53
52
|
- - ">="
|
|
54
53
|
- !ruby/object:Gem::Version
|
|
55
54
|
version: '0'
|
|
56
|
-
description:
|
|
57
55
|
email:
|
|
58
56
|
- akimichi.tatsukawa@gmail.com
|
|
59
57
|
- gemmaro.dev@gmail.com
|
|
@@ -62,14 +60,42 @@ extensions: []
|
|
|
62
60
|
extra_rdoc_files: []
|
|
63
61
|
files:
|
|
64
62
|
- ".document"
|
|
63
|
+
- ".envrc"
|
|
65
64
|
- ".rdoc_options"
|
|
66
65
|
- CHANGELOG.md
|
|
67
66
|
- Gemfile
|
|
68
67
|
- LICENSE
|
|
69
68
|
- README
|
|
70
69
|
- Rakefile
|
|
70
|
+
- TODO
|
|
71
71
|
- lib/yaparc.rb
|
|
72
|
-
-
|
|
72
|
+
- lib/yaparc/abstract_parser.rb
|
|
73
|
+
- lib/yaparc/alt.rb
|
|
74
|
+
- lib/yaparc/apply.rb
|
|
75
|
+
- lib/yaparc/char.rb
|
|
76
|
+
- lib/yaparc/cr.rb
|
|
77
|
+
- lib/yaparc/digit.rb
|
|
78
|
+
- lib/yaparc/fail_parser.rb
|
|
79
|
+
- lib/yaparc/ident.rb
|
|
80
|
+
- lib/yaparc/identifier.rb
|
|
81
|
+
- lib/yaparc/item.rb
|
|
82
|
+
- lib/yaparc/literal.rb
|
|
83
|
+
- lib/yaparc/many.rb
|
|
84
|
+
- lib/yaparc/many_one.rb
|
|
85
|
+
- lib/yaparc/nat.rb
|
|
86
|
+
- lib/yaparc/natural.rb
|
|
87
|
+
- lib/yaparc/no_fail.rb
|
|
88
|
+
- lib/yaparc/parsable.rb
|
|
89
|
+
- lib/yaparc/regex.rb
|
|
90
|
+
- lib/yaparc/satisfy.rb
|
|
91
|
+
- lib/yaparc/seq.rb
|
|
92
|
+
- lib/yaparc/space.rb
|
|
93
|
+
- lib/yaparc/string.rb
|
|
94
|
+
- lib/yaparc/succeed.rb
|
|
95
|
+
- lib/yaparc/symbol.rb
|
|
96
|
+
- lib/yaparc/tokenize.rb
|
|
97
|
+
- lib/yaparc/white_space.rb
|
|
98
|
+
- lib/yaparc/zero_one.rb
|
|
73
99
|
- sig/yaparc.gen.rbs
|
|
74
100
|
- sig/yaparc.rbs
|
|
75
101
|
- yaparc.gemspec
|
|
@@ -83,7 +109,6 @@ metadata:
|
|
|
83
109
|
homepage_uri: https://git.disroot.org/gemmaro/yaparc
|
|
84
110
|
source_code_uri: https://git.disroot.org/gemmaro/yaparc
|
|
85
111
|
wiki_uri: https://git.disroot.org/gemmaro/yaparc/wiki
|
|
86
|
-
post_install_message:
|
|
87
112
|
rdoc_options: []
|
|
88
113
|
require_paths:
|
|
89
114
|
- lib
|
|
@@ -98,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
98
123
|
- !ruby/object:Gem::Version
|
|
99
124
|
version: '0'
|
|
100
125
|
requirements: []
|
|
101
|
-
rubygems_version:
|
|
102
|
-
signing_key:
|
|
126
|
+
rubygems_version: 4.0.10
|
|
103
127
|
specification_version: 4
|
|
104
128
|
summary: Yet another simple parser combinator library
|
|
105
129
|
test_files: []
|
data/manifest.scm
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(specifications->manifest (list "ruby@3.1" "ruby-rubocop"))
|