farseer 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/farseer/and.rb +2 -0
- data/lib/farseer/any.rb +2 -0
- data/lib/farseer/char.rb +2 -0
- data/lib/farseer/chars.rb +2 -0
- data/lib/farseer/many.rb +2 -0
- data/lib/farseer/map.rb +17 -0
- data/lib/farseer/map_factory.rb +7 -0
- data/lib/farseer/opt.rb +2 -0
- data/lib/farseer/or.rb +2 -0
- data/lib/farseer/regexp.rb +2 -0
- data/lib/farseer/version.rb +1 -1
- data/lib/farseer/word.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 656cdb47ea0c930c3706c4ecb11eba8df657c4890e84a5537ba7e1aa4bcb1624
|
4
|
+
data.tar.gz: 14ec99cefd66715c3d2338fabb10ef56c8e371d2aacef140a835761e42057440
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d658b63d11e9c0aac8ffda570a1a2ab43e225645433a178981fb1850a7d6e23cf98027684e86354974082719655dad75c4b7d14386b5013e007c1bac3ad53092
|
7
|
+
data.tar.gz: e9fec41b0d13895de5c9404997f7cf6474fbda1370584806b35caa426d4c2204761650a8a874b11efbb645fc5b941fa7ba1fd9888f8334bc59472af8b7d13b7b
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.8.0] - 2024-06-04
|
11
|
+
### Added
|
12
|
+
- `Farseer::Map` which is a parser with a callback to map the resulting token
|
13
|
+
into something else.
|
14
|
+
- `Farseer::MapFactory` which adds `#map`, a factory method for new parsers with
|
15
|
+
callbacks. It creates a new instance of `Farseer::Map`.
|
16
|
+
- Included `Farseer::MapFactory` into all parsers.
|
17
|
+
|
18
|
+
|
10
19
|
## [0.7.0] - 2024-06-04
|
11
20
|
### Added
|
12
21
|
- `Farseer::And` to run a sequence of parsers that must all succeed.
|
@@ -23,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
23
32
|
### Changed
|
24
33
|
- Update development dependencies.
|
25
34
|
|
35
|
+
|
26
36
|
## [0.6.0] - 2024-06-03
|
27
37
|
### Added
|
28
38
|
- `Farseer::Opt` to parse `0` to `1` times the wrapped parser. (`?`)
|
@@ -37,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
37
47
|
### Changed
|
38
48
|
- Updated development dependencies
|
39
49
|
|
50
|
+
|
40
51
|
## [0.5.0] - 2024-06-03
|
41
52
|
### Added
|
42
53
|
- `Farseer::Char` as a single character parser.
|
@@ -54,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
54
65
|
### Changed
|
55
66
|
- Update `muina` version requirement to `~> 0.5`
|
56
67
|
|
68
|
+
|
57
69
|
## [0.4.0] - 2024-06-03
|
58
70
|
### Added
|
59
71
|
- `Farseer.any_char_parser` to parse a single character from a given set.
|
@@ -64,6 +76,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
64
76
|
- Stop using `module_function` and change methods into singleton methods.
|
65
77
|
- Update `bundler` version.
|
66
78
|
|
79
|
+
|
67
80
|
## [0.3.0] - 2024-06-02
|
68
81
|
### Added
|
69
82
|
- `Farseer#ws_parser` to parse all leading whitespace.
|
data/lib/farseer/and.rb
CHANGED
data/lib/farseer/any.rb
CHANGED
data/lib/farseer/char.rb
CHANGED
data/lib/farseer/chars.rb
CHANGED
data/lib/farseer/many.rb
CHANGED
data/lib/farseer/map.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Farseer
|
4
|
+
class Map
|
5
|
+
include MapFactory
|
6
|
+
|
7
|
+
def initialize(parser, &map)
|
8
|
+
@parser = parser
|
9
|
+
@map = map
|
10
|
+
freeze
|
11
|
+
end
|
12
|
+
|
13
|
+
def parse(input)
|
14
|
+
@parser.parse(input).map { |r| Result.new(@map.call(r.token), r.rest) }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/farseer/opt.rb
CHANGED
data/lib/farseer/or.rb
CHANGED
data/lib/farseer/regexp.rb
CHANGED
data/lib/farseer/version.rb
CHANGED
data/lib/farseer/word.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: farseer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaporyhumo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: muina
|
@@ -55,6 +55,8 @@ files:
|
|
55
55
|
- lib/farseer/char.rb
|
56
56
|
- lib/farseer/chars.rb
|
57
57
|
- lib/farseer/many.rb
|
58
|
+
- lib/farseer/map.rb
|
59
|
+
- lib/farseer/map_factory.rb
|
58
60
|
- lib/farseer/opt.rb
|
59
61
|
- lib/farseer/or.rb
|
60
62
|
- lib/farseer/regexp.rb
|