parsby 0.1.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3313d5b66907eba101433827e5cff5823b5736d1
4
- data.tar.gz: d4aa6d380a96be184afd6344627679ce5cd6ca27
3
+ metadata.gz: cf70b52f0fa6d5df40b932bc176dd97dde08c111
4
+ data.tar.gz: a6944091c5c965a9ba64e820c3430dbf288e3ac2
5
5
  SHA512:
6
- metadata.gz: 16680e582808dcbaec3f5c9d98bdbf477359d65a6448d0e48a6c3cf173d575b399b14cbeb4ccdbd754d3be4fdcd865a23a85707058c9e6b7a140f6c61598668d
7
- data.tar.gz: b8e78360be81c54cb29a8c5ebad112488c2b4f90930bd56d8b029361192bfd0530914df8f2789031f4cf35adf5d60f3e9004113d8d04ac2e20127ed45ac75f1a
6
+ metadata.gz: 1a7bd7de34f69fce4d52a0d4351eaf6b956332734ca22dcbfb8f61620d96b7290472c0073729dd05e593002ad15fde844934bfe5841401b972e5ab6bcce4c7b1
7
+ data.tar.gz: 3ca273a3e9364884fba9af7f6af1239640f170b0d5fe516096df133cd1937bd512bfe1f69a3791d17cfa37d66cbd0115731fbcfc7196e4f8db5e58d6b2d21a86
data/.gitignore CHANGED
@@ -11,3 +11,4 @@
11
11
  .rspec_status
12
12
 
13
13
  /README.md.html
14
+ /*.gem
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -374,31 +374,6 @@ class Parsby
374
374
  end
375
375
  end
376
376
 
377
- class Token
378
- attr_reader :name
379
-
380
- # Makes a token with the given name.
381
- def initialize(name)
382
- @name = name
383
- end
384
-
385
- # Renders token name by surrounding it in angle brackets.
386
- def to_s
387
- "<#{name}>"
388
- end
389
-
390
- # Compare tokens
391
- def ==(t)
392
- t.is_a?(self.class) && t.name == name
393
- end
394
-
395
- # Flipped version of Parsby#%, so you can specify the token of a parser
396
- # at the beginning of a parser expression.
397
- def %(p)
398
- p % self
399
- end
400
- end
401
-
402
377
  class Backup < StringIO
403
378
  def with_saved_pos(&b)
404
379
  saved = pos
@@ -620,14 +595,10 @@ class Parsby
620
595
 
621
596
  # The parser's label. It's an "unknown" token by default.
622
597
  def label
623
- @label || Token.new("unknown")
598
+ @label || "unknown"
624
599
  end
625
600
 
626
- # Assign label to parser. If given a symbol, it'll be turned into a
627
- # Parsby::Token.
628
- def label=(name)
629
- @label = name.is_a?(Symbol) ? Token.new(name) : name
630
- end
601
+ attr_writer :label
631
602
 
632
603
  # Initialize parser with optional label argument, and parsing block. The
633
604
  # parsing block is given an IO as argument, and its result is the result
@@ -108,7 +108,7 @@ class Parsby
108
108
 
109
109
  # Parses a decimal number as matched by \d+.
110
110
  define_combinator :decimal do
111
- many_1(decimal_digit).fmap {|ds| ds.join.to_i } % token("number")
111
+ many_1(decimal_digit).fmap {|ds| ds.join.to_i }
112
112
  end
113
113
 
114
114
  # This is taken from the Json subparser for numbers.
@@ -375,10 +375,5 @@ class Parsby
375
375
  end
376
376
  end
377
377
  end
378
-
379
- # Makes a token with the given name.
380
- def token(name)
381
- Parsby::Token.new name
382
- end
383
378
  end
384
379
  end
@@ -1,3 +1,3 @@
1
1
  class Parsby
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parsby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Luis Martinez Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-15 00:00:00.000000000 Z
11
+ date: 2020-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -79,6 +79,7 @@ files:
79
79
  - ".travis.yml"
80
80
  - Gemfile
81
81
  - Gemfile.lock
82
+ - LICENSE
82
83
  - README.md
83
84
  - Rakefile
84
85
  - bin/all-methods