kumi-parser 0.0.21 → 0.0.22
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/lib/kumi/parser/direct_parser.rb +21 -19
- data/lib/kumi/parser/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b23bd39864b3107f7f6e3c7fecf3e3791152e015a23ebe673a3e1aea2cb7553e
|
4
|
+
data.tar.gz: b60284dcb13154d1773f35d3dc4af954f794e31b546f3cd94e37f25bc84a4e1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fdb2049c0b269d1b89a20aa6481df8d199916c55f56fb0ba3fa223abf0f9e531bfa2b0a2c4619b6e676497d1acaaf37565c42114886266b3625ac224cb7121b
|
7
|
+
data.tar.gz: 8e5348e745c4b633ffc1b1b5b853281e83aa09a737593be1bfe70a1149550b5d3bffc85d8b6aae6020320b717a08b8d3cc3940d93d67caec2072676aaec205df
|
@@ -253,11 +253,11 @@ module Kumi
|
|
253
253
|
# Value declaration: 'value :name, expression' or 'value :name do ... end'
|
254
254
|
def parse_value_declaration
|
255
255
|
begin
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
256
|
+
value_token = expect_token(:value)
|
257
|
+
name_token = expect_token(:symbol)
|
258
|
+
rescue StandardError => e
|
259
|
+
binding.pry
|
260
|
+
end
|
261
261
|
|
262
262
|
if current_token.type == :do
|
263
263
|
expression = parse_cascade_expression
|
@@ -604,28 +604,30 @@ module Kumi
|
|
604
604
|
end
|
605
605
|
|
606
606
|
def parse_hash_pair
|
607
|
-
|
608
|
-
key = case key_token_type
|
609
|
-
when :label, :string
|
610
|
-
value = current_token.value.to_sym if key_token_type == :label
|
611
|
-
advance
|
612
|
-
Kumi::Syntax::Literal.new(value, loc: current_token.location)
|
613
|
-
else
|
614
|
-
raise_parse_error("Hash keys must be symbols (:key) or strings (\"key\"), got #{current_token.type}")
|
615
|
-
end
|
607
|
+
key_token = current_token
|
616
608
|
|
617
|
-
|
609
|
+
key_value =
|
610
|
+
case key_token.type
|
611
|
+
when :label then key_token.value.to_sym # render:
|
612
|
+
when :string then key_token.value # "0" => ...
|
613
|
+
when :symbol then key_token.value.to_sym # optional support for :foo => ...
|
614
|
+
else
|
615
|
+
raise_parse_error('Hash keys must be symbols (:key) or strings ("key")')
|
616
|
+
end
|
618
617
|
|
619
|
-
|
620
|
-
|
618
|
+
advance
|
619
|
+
key = Kumi::Syntax::Literal.new(key_value, loc: key_token.location)
|
620
|
+
|
621
|
+
skip_comments_and_newlines
|
622
|
+
if current_token.type == :arrow
|
621
623
|
advance
|
622
624
|
else
|
623
|
-
|
625
|
+
# Only labels may omit => (Ruby-style `key:`)
|
626
|
+
raise_parse_error("Expected '=>' in hash pair") unless key_token.type == :label
|
624
627
|
end
|
625
628
|
|
626
629
|
skip_comments_and_newlines
|
627
630
|
value = parse_expression
|
628
|
-
|
629
631
|
[key, value]
|
630
632
|
end
|
631
633
|
|
data/lib/kumi/parser/version.rb
CHANGED