farseer 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 656cdb47ea0c930c3706c4ecb11eba8df657c4890e84a5537ba7e1aa4bcb1624
4
- data.tar.gz: 14ec99cefd66715c3d2338fabb10ef56c8e371d2aacef140a835761e42057440
3
+ metadata.gz: 1f6d2e808d2e8ac8a9b119598834508dc1482f0cfaf68c34737fefb4bd261db6
4
+ data.tar.gz: 7282626a92655eb5b4044edef19689042127e22fb83e7751b5128c80f3749a89
5
5
  SHA512:
6
- metadata.gz: d658b63d11e9c0aac8ffda570a1a2ab43e225645433a178981fb1850a7d6e23cf98027684e86354974082719655dad75c4b7d14386b5013e007c1bac3ad53092
7
- data.tar.gz: e9fec41b0d13895de5c9404997f7cf6474fbda1370584806b35caa426d4c2204761650a8a874b11efbb645fc5b941fa7ba1fd9888f8334bc59472af8b7d13b7b
6
+ metadata.gz: f970a3b6804799587f2e715de0bff16efbaa6904e86259f735f6d417c5590cf0eb8bda85349509782c0258a215405c55c285159f7e31905406d08340891c3453
7
+ data.tar.gz: 7c5eaffc7d1b135bff0eae234f1322c1ded4971e0c8a68bfcd47cd43783037193d242a39e3fd2a59e06d76a267e8543967e1cde846f5dea7f2db03deb08d5ef9
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.9.0] - 2024-06-11
11
+ ### Added
12
+ - `Farseer::Empty` which always succeeds and parses nothing, returning the whole
13
+ string as rest.
14
+
15
+ ### Changed
16
+ - Change usage of `#eql?` to `#==` in `Farseer::Result`.
17
+ - `Farseer::And` does not join the resulting tokens anymore, but rather return
18
+ an array of tokens.
19
+ - Remove all development dependencies from `Gemfile` in favor of having
20
+ `lollipop` in the `gemspec`.
21
+
10
22
  ## [0.8.0] - 2024-06-04
11
23
  ### Added
12
24
  - `Farseer::Map` which is a parser with a callback to map the resulting token
data/SECURITY.md CHANGED
@@ -6,8 +6,8 @@ Currently supported version are:
6
6
 
7
7
  | Version | Supported |
8
8
  | ------- | ------------------ |
9
- | 0.6.0 | :white_check_mark: |
10
- | < 0.6.0 | :x: |
9
+ | 0.9.0 | :white_check_mark: |
10
+ | < 0.9.0 | :x: |
11
11
 
12
12
  ## Reporting a Vulnerability
13
13
 
data/lib/farseer/and.rb CHANGED
@@ -12,7 +12,7 @@ module Farseer
12
12
  def parse(input)
13
13
  return Maybe.none if @parsers.empty?
14
14
 
15
- initial = Maybe.return(Result.new('', input))
15
+ initial = Maybe.return(Result.new([], input))
16
16
 
17
17
  @parsers.reduce(initial) do |maybe_acc, parser|
18
18
  bind_accumulator(maybe_acc, parser)
@@ -32,7 +32,7 @@ module Farseer
32
32
  end
33
33
 
34
34
  def combine_results(acc_result, result)
35
- combined_tokens = acc_result.token + result.token
35
+ combined_tokens = acc_result.token + [result.token]
36
36
  Maybe.return(Result.new(combined_tokens, result.rest))
37
37
  end
38
38
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Farseer
4
+ class Empty
5
+ include MapFactory
6
+
7
+ def initialize
8
+ freeze
9
+ end
10
+
11
+ def parse(input)
12
+ Maybe.return Result.new('', input)
13
+ end
14
+ end
15
+ end
@@ -9,11 +9,11 @@ module Farseer
9
9
  end
10
10
  attr_reader :token, :rest
11
11
 
12
- def eql?(other)
12
+ def ==(other)
13
13
  self.class.eql?(other.class) and
14
- token.eql?(other.token) and
14
+ token == (other.token) and
15
15
  rest.eql?(other.rest)
16
16
  end
17
- alias == eql?
17
+ alias eql? ==
18
18
  end
19
19
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Farseer
4
- VERSION = '0.8.0'
4
+ VERSION = '0.9.0'
5
5
  public_constant :VERSION
6
6
  end
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.8.0
4
+ version: 0.9.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-05 00:00:00.000000000 Z
11
+ date: 2024-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: muina
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: lollipop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.5'
41
55
  description: Functional Parsing Library for Ruby
42
56
  email:
43
57
  - roanvilina@gmail.com
@@ -54,6 +68,7 @@ files:
54
68
  - lib/farseer/any.rb
55
69
  - lib/farseer/char.rb
56
70
  - lib/farseer/chars.rb
71
+ - lib/farseer/empty.rb
57
72
  - lib/farseer/many.rb
58
73
  - lib/farseer/map.rb
59
74
  - lib/farseer/map_factory.rb