food_ingredient_parser 1.3.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: deb4cb55b3d5c41f02171e031fd11cc996cf2e8df9f074aa163efdff58baa6b0
4
- data.tar.gz: 63dc1b52a15e6f70114cca9ed5d8a585a1f475d70131e4852310cf8755558dca
3
+ metadata.gz: 890abbbcdfd6531b7ad33fa89eeb00d25e6069b60c6c741c3495f838b3e7d8a8
4
+ data.tar.gz: 24b50c3ec559983fa228aa27274213047635b07ce74aa82e8617548c60376ae4
5
5
  SHA512:
6
- metadata.gz: 1cebae488578f1e00f8d905f34d39cef653cdcb4922d26878687afb3463ae3c24ca6592a6f19ac482b5a2f08e95feef342c9631da69acb99feea4e1a81269057
7
- data.tar.gz: a7c8b98a5c3fd3aee8962e8f31cd9a0ede791e8d7c7193bfbb1ba2524be057bd7b38499973cd6ab6fea58020161ba6f8615dc5eef2191a87d45afec4662fa264
6
+ metadata.gz: 758d0c351607a416fe801eb2ca839c831e6e996a39d528ffbc233b5dd15f895da6dc56adb79209d0736f25ece1217d3bcf696e395c80a038e70dc674d0669ef8
7
+ data.tar.gz: 5a36027d26908085f56e6e976dcb992cc422225830e99befed59e32475516f5fe5c642e9db27e28f47466a17519c25e46f1f8c601385432e55680089deac0c9d
@@ -13,5 +13,13 @@ module FoodIngredientParser::Strict::Grammar
13
13
  )
14
14
  end
15
15
 
16
+ rule ingredient_nocol
17
+ ws*
18
+ (
19
+ ingredient_nested ( ws* and ws+ ingredient )? /
20
+ ingredient_simple_with_amount
21
+ )
22
+ end
23
+
16
24
  end
17
25
  end
@@ -14,6 +14,14 @@ module FoodIngredientParser::Strict::Grammar
14
14
  contains:( ingredient_coloned_simple_with_amount_and_nest ( ws* '/'+ ws* ingredient_coloned_simple_with_amount_and_nest )* ) <ListNode>
15
15
  end
16
16
 
17
+ rule ingredient_coloned_semicol
18
+ ing:ingredient_simple ws* ':' post:( ws* '}' )? ws* contains:( ingredient_coloned_semicol_inner_list ) ';' <NestedIngredientNode>
19
+ end
20
+
21
+ rule ingredient_coloned_semicol_inner_list
22
+ contains:( ingredient_coloned_simple_with_amount_and_nest ( ws* ',' ws* ingredient_coloned_simple_with_amount_and_nest )* ) <ListNode>
23
+ end
24
+
17
25
  # @see IngredientSimple#ingredient_simple
18
26
  rule ingredient_coloned_simple
19
27
  name:( ingredient_coloned_word ( ws+ !amount ingredient_coloned_word )* ) ws? mark:mark <IngredientNode> /
@@ -2,8 +2,10 @@ module FoodIngredientParser::Strict::Grammar
2
2
  grammar List
3
3
  include Common
4
4
  include Ingredient
5
+ include IngredientColoned
5
6
 
6
7
  rule list
8
+ list_coloned_semicol /
7
9
  contains:(ingredient ( ws* '|' ws* ingredient )+ ( ws+ and ws+ ingredient )? ) <ListNode> /
8
10
  contains:(ingredient ( ws* ';' ws* ingredient )+ ( ws+ and ws+ ingredient )? ) <ListNode> /
9
11
  contains:(ingredient ( ws* ',' ws* ingredient )+ ( ws+ and ws+ ingredient )? ) <ListNode> /
@@ -12,5 +14,13 @@ module FoodIngredientParser::Strict::Grammar
12
14
  contains:(ingredient_simple_e_number ( ws* dash ws* ingredient_simple_e_number )+ ) <ListNode> /
13
15
  contains:(ingredient ( ws+ and ws+ ingredient )? ) <ListNode>
14
16
  end
17
+
18
+ rule list_coloned_semicol
19
+ contains:(
20
+ ( (ingredient_nocol ws* ',' ws*)* ws* ingredient_coloned_semicol )+
21
+ ( ws* ingredient_nocol (ws* ',' ws* ingredient_nocol)* )?
22
+ ( ws+ and ws+ ingredient_nocol )?
23
+ ) <ListNode>
24
+ end
15
25
  end
16
26
  end
@@ -17,9 +17,10 @@ module FoodIngredientParser::Strict::Grammar
17
17
  end
18
18
 
19
19
  rule list_coloned_inner_list
20
+ contains:( ingredient ( ws* ',' ws* ingredient )+ ( ws+ and ws+ ingredient )? ) <ListNode> /
20
21
  contains:( ingredient_simple_e_number ( ws* '/' ws* ingredient_simple_e_number )+ ) <ListNode> /
21
22
  contains:( ingredient_simple_e_number ( ws* dash ws* ingredient_simple_e_number )+ ) <ListNode> /
22
- contains:( ingredient ( ws* ',' ws* ingredient )* ) <ListNode>
23
+ contains:( ingredient ( ws+ and ws+ ingredient )? ) <ListNode>
23
24
  end
24
25
 
25
26
  rule list_coloned_ingredient
@@ -8,7 +8,7 @@ module FoodIngredientParser::Strict::Grammar
8
8
  rule root
9
9
  '"'?
10
10
  root_prefix? ws*
11
- contains:( list_newlined / list_coloned / list )
11
+ contains:( list_newlined / list_coloned_semicol / list_coloned / list )
12
12
  notes:(
13
13
  root_mark_sentences_in_list? ws*
14
14
  ( ( [.;] ws* newline* / [.;]? ws* newline+ ) ws* root_sentences? ws* )?
@@ -1,4 +1,4 @@
1
1
  module FoodIngredientParser
2
- VERSION = '1.3.0'
3
- VERSION_DATE = '2024-06-13'
2
+ VERSION = '1.4.0'
3
+ VERSION_DATE = '2024-06-19'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: food_ingredient_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - wvengen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-13 00:00:00.000000000 Z
11
+ date: 2024-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: treetop